Print a Hyperlinked Document

M

MJBAccess

I'm trying to use a command button to print a Word document that is in a
Hyperlink field. I keep getting Run-Time Error 5273 and it says the
document name or path is not valid. The Hyperlink opens fine if I open it
manually but not with this code. Any ideas? I'm Access 2002 with WinXP and
all the latest updates. I do have Word Objects 10.0 selected under Tools
Reference.
Thanks,
Mike

Dim oApp As Object
Dim beginning As Single
'Hyper is the text box name that contains the hyperlink
Set oApp = CreateObject("Word.Application")
oApp.Documents.Open FileName:=Me.hyper.hyperlink.Address
oApp.PrintOut FileName:=""

'this will pause the code during 5 seconds, giving some time
'to Word app to send the document to the printer, before quit
'
beginning = Timer
Do While Timer < begining + 5
DoEvents
Loop

oApp.ActiveDocument.Close
oApp.Quit
Set oApp = Nothing
 

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