Word from Excel
Not tested, but try to trap it
Dim WordObj As Object
On Error Resum Next
Set WordObj = CreateObject("Word.Basic")
On Error Goto 0
If WordObj Is Nothing Then
Msgbox "Bookmark not found"
Else
Selection.Hyperlinks(1).Follow NewWindow:=True,
AddHistory:=True
Application.WindowState = xlMaximized
With WordObj
.EditBookmark "txtNo", 0, 0, 0, 1
.Insert txtNo.Value
End With
End If
--
HTH
RP
"Simon" wrote in message
...
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
|