Article ID: 172483
Article Last Modified on 1/20/2007
Public Sub Macro1(s As String, i As Integer)
MsgBox s 'Display the string
MsgBox i * 10 'Display the product i and 10
End Sub
Option Explicit
Dim objWordApp As Word.Application
Dim objWordDoc As Word.Document
Private Sub Form_Click()
'Create a new instance of Word
Set objWordApp = New Word.Application
'Open the document containing the macro
Set objWordDoc = _
objWordApp.Documents.Open("C:\TEST.DOC")
'Run the macro
objWordDoc.macro1 "Hello!", 23
'Close the document and clear the variables
objWordDoc.Close
Set objWordDoc = Nothing
Set objWordApp = Nothing
End Sub
Keywords: kbautomation kbhowto kbinterop KB172483