Dear
I generate a Word-document with information from my Access database. I also add hypertext with hyperlinks to the Word-document.
This works fine on Windows 7 with MS Access2010 using ActiveDocument.Hyperlinks.Add.
Now I run the same code on Windows Server 2008, but I don't see any hyperlinks anymore in my Word-document.
I tried to use Application.FollowHyperlink, but using this command, you are immediately redirected to the file and I need hypertext: the reader of the Word-document must click on the text before he or she is redirected.
Here is some sample code :
This works on any computer, but on Windows Server 2008, I get the following error :
runtime error '5825'
Object has been deleted
Debugging highlights the ActiveDocument.Hyperlinks.Add
Removing the definition of 'selection' makes the error disappear, but then I don't see any hyperlink appearing in the word document.
Is there a solution ? Is there an alternative to Hyperlinks.Add command ?
Regards
Jurgen
I generate a Word-document with information from my Access database. I also add hypertext with hyperlinks to the Word-document.
This works fine on Windows 7 with MS Access2010 using ActiveDocument.Hyperlinks.Add.
Now I run the same code on Windows Server 2008, but I don't see any hyperlinks anymore in my Word-document.
I tried to use Application.FollowHyperlink, but using this command, you are immediately redirected to the file and I need hypertext: the reader of the Word-document must click on the text before he or she is redirected.
Here is some sample code :
Code:
Option Compare Database
Public WordApp As Word.Application
Public doc As Word.Document
Public Selection As Word.Selection
Public Sub test()
Set WordApp = New Word.Application
WordApp.Documents.Add
Set doc = WordApp.ActiveDocument
Set Selection = WordApp.Selection
WordApp.Visible = True
ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:= _
"adres", SubAddress:="", ScreenTip:="", TextToDisplay:= _
"test"
End Sub
This works on any computer, but on Windows Server 2008, I get the following error :
runtime error '5825'
Object has been deleted
Debugging highlights the ActiveDocument.Hyperlinks.Add
Removing the definition of 'selection' makes the error disappear, but then I don't see any hyperlink appearing in the word document.
Is there a solution ? Is there an alternative to Hyperlinks.Add command ?
Regards
Jurgen
Last edited: