I've created a module in excel to simply pass variables to a word document using Applicaton.run
This is the macro in excel
-------------------------------------------
Sub excelmacro()
Set wordapp = CreateObject("Word.Application"
wordapp.Documents.Open ("c:\test.doc"
wordapp.Visible = True
Call wordapp.Run("Project.module1.wordmacro", "my name"
End Sub
-----------------------------------------
....which is calling this macro in word
----------------------------------------------
Public Sub wordmacro(name As String)
MsgBox name
End Sub
-----------------------------------------------
This brings an error, but if i don't try to pass a variable to the macro it succeeds.
------------------------------------------
Sub excelmacro()
Set wordapp = CreateObject("Word.Application"
wordapp.Documents.Open ("c:\test.doc"
wordapp.Visible = True
Call wordapp.Run("Project.module1.wordmacro"
End Sub
-----------------------------------------------
Public Sub wordmacro()
Msgbox "this works"
End Sub
----------------------------------------------------
Can i not pass variables from one application to another?
Please help
This is the macro in excel
-------------------------------------------
Sub excelmacro()
Set wordapp = CreateObject("Word.Application"
wordapp.Documents.Open ("c:\test.doc"
wordapp.Visible = True
Call wordapp.Run("Project.module1.wordmacro", "my name"
End Sub
-----------------------------------------
....which is calling this macro in word
----------------------------------------------
Public Sub wordmacro(name As String)
MsgBox name
End Sub
-----------------------------------------------
This brings an error, but if i don't try to pass a variable to the macro it succeeds.
------------------------------------------
Sub excelmacro()
Set wordapp = CreateObject("Word.Application"
wordapp.Documents.Open ("c:\test.doc"
wordapp.Visible = True
Call wordapp.Run("Project.module1.wordmacro"
End Sub
-----------------------------------------------
Public Sub wordmacro()
Msgbox "this works"
End Sub
----------------------------------------------------
Can i not pass variables from one application to another?
Please help