PDA

View Full Version : Solved: Opening a doc



bopo
01-19-2007, 12:31 PM
HI

I have this code beind a commandbutton:


Documents.Open FileName:="C:\sh.doc"


However a error message keeps occuring say object not found, I have tried mutiple locations (placing the doc in different locations and changing the code)

?

Norie
01-19-2007, 12:54 PM
Is this in Word or Excel?

Because you've posted in the Excel section.:)

bopo
01-19-2007, 01:03 PM
Excel, I want to open a word document using vba with my userform within excel

CBrine
01-19-2007, 01:39 PM
bopo,
Requires a little more work from Excel.



Sub OpenWord()
Dim newApp As Object
Set newApp = GetObject("C:\test.doc")
newApp.Application.Visible = True
End Sub


HTH
Cal

mdmackillop
01-19-2007, 01:49 PM
or
Sub OpenWord()
ActiveWorkbook.FollowHyperlink "C:\test.doc"
End Sub