Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Need Excel count of 1 word if found in multi-word cells of column | Excel Worksheet Functions | |||
excel object linked to word will not add sums in word | Excel Discussion (Misc queries) | |||
Excel 7, paste linked to word becomes black when word pdf'd | Excel Discussion (Misc queries) | |||
Copy from Word to Excel, and retain indent, plus word wrap | Excel Discussion (Misc queries) | |||
Print labels by using Excel data in a Word mail into word | Excel Discussion (Misc queries) |