Problems running a sub having arguments

S

Stuart

From the Immediate window, this statement:

Application.Run "BofQUtilities.xla!InDirect_Menu_Routines.Test1"

results in the following macro successfully running:

Sub Test1()
MsgBox ("Success")
End Sub

but this statement:

Application.Run _

"BofQUtilities.xla!InDirect_Menu_Routines.ReNumberBofQPages(myCell, ws,
£Col)"

results in an error message, saying the macro cannot be found.

The macro exists, and I'm fairly sure there are no typos.

Any ideas please?

Regards.
 
B

Bob Phillips

Stuart,

Haven't tried it myself, but try

Application.Run _
("BofQUtilities.xla!InDirect_Menu_Routines.ReNumberBofQPages", myCell, ws,
£Col)


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
S

S?ren Remfeldt

Hi Stuart!
Try this instead
Application.Run _
"BofQUtilities.xla!InDirect_Menu_Routines.ReNumberBofQPages myCell, ws,£Col
without the"()".....
It might work!
;-) Søren Remfeldt
 
D

Dave Peterson

Without taking time to setup variables (I passed all strings), this worked ok:

Option Explicit
Sub testme()

Dim myCell As String
Dim ws As String
Dim myCol As String

myCell = "hi"
ws = "there"
myCol = "!"
Application.Run _
"book3.xla!InDirect_Menu_Routines.ReNumberBofQPages", _
myCell, ws, myCol

End Sub

And the macro looked like:
Option Explicit
Sub ReNumberBofQPages(myCell As String, ws As String, myCol As String)
MsgBox myCell & "--" & ws & "--" & myCol
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top