|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Copy Word Doc Bookmarks from One Document to another (VB.net)bookmark and select them etc. I can create the bookmark in the second word doc, with the correct name. The problem is set the location of the bookmark Any help here would be great WrdDoc is the destination doc WrdTemplate is the source doc ----------------------------------------- If WrdDoc.Bookmarks.Count = 0 Then '# Set Template Document Path Dim strTemplatePath As String = "C:\Temp\test.doc" '# Open Template WrdTemplate = WrdApp.Documents.Open(strTemplatePath) '# Get BookMarks For Each BookMark As Word.Bookmark In WrdTemplate.Bookmarks Debug.Print(BookMark.Name.ToString) ---- WrdDoc.Bookmarks.Add(BookMark.Name, bookmark.range) ------- Problem Here Next WrdTemplate.Close() i get the following error The specified range is not from the correct document or story. Understand what the error is saying, but have not got a clue to how to get around it. Am 09.04.2010 10:47, schrieb Barry:
> i get the following error I think you have a Word automation problem, not a VB.Net problem.> > > The specified range is not from the correct document or story. > > > Understand what the error is saying, but have not got a clue to how > to > get around it. The guys in the Word VBA group should know it. -- Armin On 9 Apr, 09:53, Armin Zingler <az.nos***@freenet.de> wrote:
Show quoteHide quote > Am 09.04.2010 10:47, schrieb Barry: It okay i have work it out> > > i get the following error > > > The specified range is not from the correct document or story. > > > Understand what the error is saying, but have not got a clue to how > > to > > get around it. > > I think you have a Word automation problem, not a VB.Net problem. > The guys in the Word VBA group should know it. > > -- > Armin For Each BookMark As Word.Bookmark In WrdTemplate.Bookmarks Dim NewRange As Word.Range NewRange = WrdDoc.Range(BookMark.Range.Start, BookMark.Range.End) WrdDoc.Bookmarks.Add(BookMark.Name, NewRange) Next Thanks
Owner Drawn form background problems
Treeview duplicate nodes (VB.NET 2008) Gridview order Accessing Sub Menu Items ASP Tab Control Single v. Double Help Use a static form of the EventLog class? How to tell if folder item is file or folder? null reference exception could result at runtime How to get the list of all SQL Server foreign keys in a database by using Microsoft.SqlServer.Manage |
|||||||||||||||||||||||