create hyperlink

  • Thread starter samotek via AccessMonster.com
  • Start date
S

samotek via AccessMonster.com

I my database i have a code that creates a word document. In this document i
create a hyperlink to my database using Insert-hyperlink.Can i create the
hyperlink in my fucntion by defining the path and the name of the database ?

Public Function MyNotes()
Dim appW As Object
Dim docW As Object
Dim nErr As Integer
Const strFile = "C:\Be\Notes.doc"
On Error Resume Next
Set appW = GetObject(, "Word.Application")
nErr = Err
On Error GoTo 0
If nErr Then
Set appW = CreateObject("Word.Application")
End If
' Does document exist?
If Dir(strFile) = "" Then
' If not, create it
Set docW = appW.Documents.Add
' And save it
docW.SaveAs strFile
Else
' If it does exist, open it
Set docW = appW.Documents.Open(strFile)
End If
appW.Visible = True
Set docW = Nothing
Set appW = Nothing
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top