T
Travich
This topic has been discussed numerous times that I can find, but even
with all the discussion I cannot get Application.Run to work for me.
So here's what I did. I set up a test.xls and a test2.xls. In
test.xls, I created a basTest and put in the following code:
Public Sub GetMessage()
MsgBox "Message from test was received.", vbOKOnly, "GetMessage"
End Sub
In test2.xls, I've created a button and tried to call application.run,
here's what I currently have:
Private Sub CommandButton1_Click()
Dim WB As Excel.Workbook
Dim Path as String
On Error GoTo ErrorHandler
Path = Application.GetOpenFilename("Excel File,*.xls", , "Test",
"Open", False)
Set WB = GetObject(Path)
WB.Application.Run "!GetMessage'"
'GetMessage
Exit Sub
ErrorHandler:
MsgBox "Err: " & Err.Description & " Number: " & Err.Number
End Sub
This throws the Err: 1004, Cannot Find Macro. As well as do the
following changes that I've made to the code.
'Tried this, and got the same error.
WB.Application.Run WB.Name & "!GetMessage'"
'Tried this and got the same error.
Application.Run WB.Name & "!GetMessage'"
'Tried this and got the same error.
Application.Run FileName & "!GetMessage'"
I've tried several other variations and absolutely cannot access the
sub. What am I doing wrong???
with all the discussion I cannot get Application.Run to work for me.
So here's what I did. I set up a test.xls and a test2.xls. In
test.xls, I created a basTest and put in the following code:
Public Sub GetMessage()
MsgBox "Message from test was received.", vbOKOnly, "GetMessage"
End Sub
In test2.xls, I've created a button and tried to call application.run,
here's what I currently have:
Private Sub CommandButton1_Click()
Dim WB As Excel.Workbook
Dim Path as String
On Error GoTo ErrorHandler
Path = Application.GetOpenFilename("Excel File,*.xls", , "Test",
"Open", False)
Set WB = GetObject(Path)
WB.Application.Run "!GetMessage'"
'GetMessage
Exit Sub
ErrorHandler:
MsgBox "Err: " & Err.Description & " Number: " & Err.Number
End Sub
This throws the Err: 1004, Cannot Find Macro. As well as do the
following changes that I've made to the code.
'Tried this, and got the same error.
WB.Application.Run WB.Name & "!GetMessage'"
'Tried this and got the same error.
Application.Run WB.Name & "!GetMessage'"
'Tried this and got the same error.
Application.Run FileName & "!GetMessage'"
I've tried several other variations and absolutely cannot access the
sub. What am I doing wrong???