LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Application.Run Call Err: 1004 Cannot Find Macro

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???

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application Error 1004 ExcelMonkey[_190_] Excel Programming 4 February 9th 05 01:55 AM
Application / Object Error 1004 Garry[_7_] Excel Programming 7 October 6th 04 01:22 PM
Macro Run-time Error 1004 Application Defined or Object Defined Error Anddmx Excel Programming 6 June 9th 04 03:40 PM
Application error 1004 with a twist. Darren Lord Excel Programming 1 August 22nd 03 12:30 PM
Application error 1004. Darren[_5_] Excel Programming 2 August 12th 03 09:52 AM


All times are GMT +1. The time now is 09:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"