Thread: Word from Excel
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
simon simon is offline
external usenet poster
 
Posts: 21
Default Word from Excel

I'm using excel to open a preformatted word document from
a hyperlink and adding data from the excel record using
bookmarks. I want the word document to be saved according
to the bookmark value. I can't seem to be able to get the
last bit to work. Also everynow and then the code stops
because it can't find the bookmark and the only apparent
round this to get it working again is by logging off and
on again. The code I'm using is

Dim WordObj As Object
Set WordObj = CreateObject("Word.Basic")
Selection.Hyperlinks(1).Follow NewWindow:=True,
AddHistory:=True
Application.WindowState = xlMaximized
With WordObj
.EditBookmark "txtNo", 0, 0, 0, 1
.Insert txtNo.Value
End With

Any suggestions much appreciated