Problems running a sub having arguments

  • Thread starter Thread starter Stuart
  • Start date Start date
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.
 
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)
 
Hi Stuart!
Try this instead
Application.Run _
"BofQUtilities.xla!InDirect_Menu_Routines.ReNumberBofQPages myCell, ws,£Col
without the"()".....
It might work!
;-) Søren Remfeldt
 
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
 
Back
Top