2008年10月19日 星期日

Notes To Word可以避免『文字字串太長』的作法



MS Word String Too Long
-----------------------------
透過Word的「插入\功能變數」+「插入\書籤」的方法:
如圖(一):
然後在Word上建立『Introduction』這欄位,並且定義書籤「插入\書籤」如圖(二);即可準確的讓Notes文字資料轉至Word上。
-----------------------------
You could try this:

1. Create a text field in Word (using the form toolbar).
2. Double click on it to display a dialog box
3. Specify a Bookmark name under Field Settings
4. If the field on the Notes document is called "Introduction" and the Bookmark in Word is called "Introduction" the following code should work for you irrespective of the length of the string in the field:

'DECLARATIONS
Dim ws as New NotesUIWorkspace
Dim uidoc as NotesUIDocument
Dim doc as NotesDocument
Dim word As Variant
Dim wordoc As Variant
Dim temp as string

'GET A HANDLE ON THE NOTES DOCUMENT TO BE EXPORTED
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document

'CREATE THE WORD OBJECT
Set word = CreateObject("Word.Application")
Call word.documents.add ( "c:\worddoc.doc" )
Set worddoc = word.activedocument

'WRITE OUT THE FIELD VALUE TO WORD
If doc.Introduction(0) <> "" Then
temp = doc.Introduction(0)
WordDoc.Bookmarks("Introduction").Select
Call Word.Selection.TypeText(temp)

Else
temp = ""
WordDoc.Bookmarks("Introduction").Select
Call Word.Selection.TypeText(temp)
End If