opening a word document

R

RAHokie

I too have encountered this problem.
I attempted to use the suggestion but when I enter the code:

Dim oApp As Object

Set oApp = CreateObject("Word.Application")
oApp.Visible = True
oApp.Document.Open "C:\Documents and Settings\u8ra10\My
Documents\AltCreditPendDoc.doc"

I get this error message: "Object doesn't support this property or method"
How can I fix this?
 
A

Alex White MCDBA MCSE

I think you need another var

Dim oDoc as Object

and change the line

set oDoc = oApp.Document.Open "C:\Documents and Settings\u8ra10\My
Documents\AltCreditPendDoc.doc"


if that does not fix it, then it may be the spaces in the path above.
 
A

Albert D.Kallal

Do you actually need word automaton here, or just want to open the document?

If you just want to open the document, you can use:


application.FollowHyperlink "C:\Documents and
Settings\u8ra10\MyDocuments\AltCreditPendDoc.doc"
 
A

Alex White MCDBA MCSE

Albert

I think your right, sometimes I cannot see the wood for the trees.
 
A

Albert D.Kallal

Alex White MCDBA MCSE said:
Albert

I think your right, sometimes I cannot see the wood for the trees.

Actually, not much of a issue either way. We actually don't know, or can't
tell if automation is needed here. So, having two solutions is still good.
And, really, at the end of day, your attitude is one of trying to help, and
contribute to this group. Really, can't complain either way..can we??
 
R

RAHokie

It IS Documents! Thanks a lot. Document was the solution offered in an
earlier post!
 
R

RAHokie

It should read OpenDocuments not OpenDocument

Alex White MCDBA MCSE said:
I think you need another var

Dim oDoc as Object

and change the line

set oDoc = oApp.Document.Open "C:\Documents and Settings\u8ra10\My
Documents\AltCreditPendDoc.doc"


if that does not fix it, then it may be the spaces in the path above.


--
Regards

Alex White MCDBA MCSE
http://www.intralan.co.uk
 
D

daviep

Hi,

I have a related problem. I am using automation to open a Word 9.0 document
from Access using VBA code. The document opens, however I receive a "File in
Use" popup notifying me that the file is already in use by me?!?

I have used the following code to open the document:

' Open document
wdApp.Documents.Open FileName:=vsDoc, ReadOnly:=False,
AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", Revert:=False,
WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto

where wdApp is my object and vsDos contains my file name.

I am obviosly missing something here. Any advice?

Thanks in advance.
Regards,
D
 
Top