>I haven't done a lot of Word automation, and none recently. However, the
>help file says that the first, "pathname" argument must be the full path
[quoted text clipped - 40 lines]
>> Filename is correct - Not using a path because the file is local (Tried
>> it with full path - still no go) - CreateObject works with new app
The code isn't intended to display a document, only to demonstrate that
GetObject(full path/name of Word document) returns a Word.Document object,
not a Word.Application object, and that you can retrieve the Application
object using the Parent property of the Document object. So 'no error
message' and 'no document' are both as expected.
The Debug window and the Immediate window are the same window. The code was
designed to be executed from the Immediate window. You must have executed it
some other way, as I see you have changed my original procedure
declaration - you've changed 'Public' to 'Private'. You'll need to change it
back to Public to execute the code from the Immediate window, and ensure
that you have pasted the code into a standard module, not a class module
(this includes form and report modules). Alternatively, modify the code to
display message boxes instead of writing to the Debug/Immediate window ...
Public Sub TestGetObject()
Dim objApp As Object
Dim objDoc As Object
Set objDoc = GetObject("u:\!Clait2006\CLAIT2006
database\Congratulations.doc")
MsgBox objDoc.Name
Set objApp = objDoc.Parent
MsgBox objApp.Name
Set objDoc = Nothing
Set objApp = Nothing
End Sub

Signature
Brendan Reynolds
>i tried your code as is (except the path):
>
[quoted text clipped - 62 lines]
>>> Filename is correct - Not using a path because the file is local (Tried
>>> it with full path - still no go) - CreateObject works with new app
JethroUK© - 22 Oct 2005 23:24 GMT
i've never used debug window - i dont do much programming - but it works now
thanks - my original error was in:
objDoc.Visible = True
i was getting an error - i took the line out and couldn't see anything, when
i really only needed to put :
objDoc.Application.Visible = True
bit disappointed about having to put the absolute path when a relative path
would make it more portable (i'm working on several machines) oh hum - glad
it's sorted, i've planned about 5-6 mail-merges out of the database so i was
a bit concerned - thanks again
> The code isn't intended to display a document, only to demonstrate that
> GetObject(full path/name of Word document) returns a Word.Document object,
[quoted text clipped - 98 lines]
> >>> Filename is correct - Not using a path because the file is local (Tried
> >>> it with full path - still no go) - CreateObject works with new app