LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jag Jag is offline
external usenet poster
 
Posts: 16
Default Checking for bookmarks in Word document

I have a spreadsheet that the users fills in several fields, etc. then clicks a button to print a report. The report is a Word template file that has several bookmarks set where the data should be populated. I want to check for the existance of the bookmark in the document and update it if it exist in the document, (I have several reports and want to use the same procedure for all, but all reports will not have all the bookmarks). The code is listed below. My problem when the code runs, the template file is opened, but the bookmarks are not updated. The if statement checking for the bookmark runs and skips the bookmark as if it is not there. I can remove the if statement and the bookmark is updated. What have I done wrong in my coding.... Any help is appreciated.

Dim WordApp As Word.Application
Set WordApp = New Word.Application

Call Get_Excel_Info
With WordApp
.Visible = True
.Documents.Add Template:=TemplatePath & TemplateToOpen, newtemplate:=False
.Application.WindowState = wdWindowStateMaximize
If .ActiveDocument.ProtectionType < wdNoProtection Then
.ActiveDocument.Unprotect Password:=""
End If
If WordApp.ActiveDocument.Bookmarks.Exists(BM_License e) Then
WordApp.ActiveDocument.Bookmarks("BM_Licensee").Ra nge.InsertAfter Txt_Licensee
End If
end with
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I convert an Excel document to a Word Document has3801 Setting up and Configuration of Excel 1 June 11th 08 11:16 PM
Cross reference bookmarks in a Microsoft word document FredN Excel Discussion (Misc queries) 0 April 7th 08 04:33 PM
convert excel document to word document (not a picture) frendabrenda1 Excel Discussion (Misc queries) 2 October 6th 06 03:55 PM
How do I convert Word document into an Excel document? Jamie Excel Discussion (Misc queries) 3 April 7th 05 09:45 PM
Using Word Bookmarks to read Text Charles Excel Programming 2 February 12th 04 03:40 PM


All times are GMT +1. The time now is 03:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"