Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using DDE to open Word file then run Word macro

Status
Not open for further replies.

mflancour

MIS
Apr 23, 2002
379
US
Hello. I want to write something that will open a MSWord file then run a MSWord macro on that file of some name. I was able to find a decent example of a DDE code in Access's help but it does not work. I get an "Overflow" error. Any way following is what I attempted to use:

Dim intI As Integer, intChan1 As Integer
Dim strTopics As String, strResp As String, strSheetName As String
On Error Resume Next
intChan1 = DDEInitiate("winword", "System")'**Error here**
If Err Then
Err = 0
Shell "Excel", 1
If Err Then Exit Sub
intChan1 = DDEInitiate("winword", "System")
End If
DDEExecute intChan1, "Application.run macroname:=""macro1""" '**not sure if this is correct
**verbage to run a macro**
DDETerminateAll
 

Try Dim IntI as Long, Dim IntChan1 as Long. That should eliminate your overflow problem..

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top