dbTalk Databases Forums  

SET command for an object

comp.database.ms-access comp.database.ms-access


Discuss SET command for an object in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Nigel Root
 
Posts: n/a

Default SET command for an object - 09-03-2003 , 11:50 AM






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).

Thanks,
Nigel Root

Reply With Quote
  #2  
Old   
MikeB
 
Posts: n/a

Default Re: SET command for an object - 09-03-2003 , 12:56 PM







"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...
Quote:
Thanks,
Nigel Root



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.