|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Copy bookmarks to new document
I have a document with several bookmarks. I created a form
to list all the bookmarks and then choolse which bookmarks I would like to add to a new document. When I click on the OK button, either nothing happens, or it will copy all the bookmark text. I would like it to copy the selected bookmarked text. The macro to open up the file and bring up the file opens a new document but nothing is added to this document. Here is the OK_click() code: Private Sub cmdOK_Click() 'set counter to number of clauses selected ListCounter = lstClauses.ListCount - 1 'loop through the listbox collection, and pull each clause into documet For i = 0 To ListCounter strParaName = lstClauses.List(i) 'this line is supposed to work, but gives me an error about "strDocumentName" 'which is used in the form. Selection.InsertFile FileName:=strDocumentName, Range:=strParaName 'this line gets the selection but adds it to clause document. Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= "" & strParaName 'This line gives error about not valid bookmark ' Documents.Add DocumentType:=wdNewBlankDocument Selection.EndKey Unit:=wdLine Selection.TypeParagraph Next i 'unload selection form, leaving just document on screen Unload Me 'Highlight entire document and update the field codes Selection.WholeStory Selection.Fields.Update 'all text has been assembled and completed unlink text from ctrl shift f9 Selection.Fields.Unlink 'go to end of document Selection.EndKey Unit:=wdStory End Sub Any help would be greatly appreciated. |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Copy bookmarks to new document |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|