"Nigel Root" <nigel_root (AT) yahoo (DOT) com> wrote
Quote:
The second paragraph of the code below is from the Help of Access
2002. I don't know how to declare the variable MyObj. Please help.
Dim MyObj As Object
Set MyObj = ?????
MyObj.Insert "Hello, world." ' Place text.
MyObj.Bold = True ' Format text.
MyObj.SaveAs "C:\TESTOBJ.DOC" ' Save the object (Windows). |
and the next paragraph says:
Use the following functions to access an Automation object:
Function Description
CreateObject Creates a new object of a specified type.
GetObject Retrieves an object from a file.
For details on the properties and methods supported by an application, see the application
documentation. The objects, functions, properties, and methods supported by an application are
usually defined in the application's object library.
So, if the object didn't exist, then you would:
Set MyObj = CreateObject(class,[servername])
You should look up the CreateObject function and in this instance, the object you are trying to
create is a Word document object. There are a couple of ways with word. The specific type library
for the version of word installed on your computer and a less complex, but more generic version that
is backward compatible across several versions. You could Google for: vba Automation word
Createobject [I got 1590 hits] and you will get sufficient hits to start you along your way...