Exec. Word VBA Function From Access using VBA 
Author Message
 Exec. Word VBA Function From Access using VBA

I am using OLE automation in Access to control a word
document.  Within the word document is a VBA Function which
I want to execute from Access.

I have a function which requires 3 parameters.  How do I
run the function within a word document from Access????    

Below is how my Access VBA is setup:

Static wdApp As Word.Application
Static wdDoc As Word.Document
Static x As Integer

Set wdApp = CreateObject("Word.Application")
Set wdDoc = wdApp.Documents.Open("c:\data\Test 2002.doc")
wdApp.Visible = True

What would I need to execute a VBA Function inside Word??

Thank You,

Gary



Tue, 08 Mar 2005 06:31:03 GMT  
 Exec. Word VBA Function From Access using VBA
Put the function (let's call it myfunc) in the ThisDocument area under your
document (i.e. Test 2002| Microsoft Word Objects|ThisDocument.

then use

myresult = wdDoc.myfunc(whatever parameters you need)

Peter Jamieson


Quote:
> I am using OLE automation in Access to control a word
> document.  Within the word document is a VBA Function which
> I want to execute from Access.

> I have a function which requires 3 parameters.  How do I
> run the function within a word document from Access????

> Below is how my Access VBA is setup:

> Static wdApp As Word.Application
> Static wdDoc As Word.Document
> Static x As Integer

> Set wdApp = CreateObject("Word.Application")
> Set wdDoc = wdApp.Documents.Open("c:\data\Test 2002.doc")
> wdApp.Visible = True

> What would I need to execute a VBA Function inside Word??

> Thank You,

> Gary



Tue, 08 Mar 2005 18:56:27 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. HELP: MERGE TO WORD FUNCTION USING VBA

2. using VBA function in Word field

3. Creating Embedded word documents from within Access using VBA

4. Using Access VBA with Word

5. Retrieving Access OLE Object data from Word VBA using DAO

6. Open Word from Access Using VBA....

7. Problem in running Excel sort function in Access using VBA

8. Print formatting problems -- Using VBA in Access 2000 to print a doc in Word

9. Executing a Records from Word VBA using an Access UDF

10. SQL Error 3085 - Using Access VBA Functions in VB4

11. SQL Error 3085 - Using MS-Access VBA Functions in VB 4

12. Access 97 VBA v Access 2K VBA - different ?

 

 
Powered by phpBB® Forum Software