ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problems running a sub having arguments (https://www.excelbanter.com/excel-programming/279789-problems-running-sub-having-arguments.html)

Stuart[_5_]

Problems running a sub having arguments
 
From the Immediate window, this statement:

Application.Run "BofQUtilities.xla!InDirect_Menu_Routines.Test 1"

results in the following macro successfully running:

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

but this statement:

Application.Run _

"BofQUtilities.xla!InDirect_Menu_Routines.ReNumber BofQPages(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.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.524 / Virus Database: 321 - Release Date: 06/10/2003



Bob Phillips[_5_]

Problems running a sub having arguments
 
Stuart,

Haven't tried it myself, but try

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


--

HTH

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

"Stuart" wrote in message
...
From the Immediate window, this statement:

Application.Run "BofQUtilities.xla!InDirect_Menu_Routines.Test 1"

results in the following macro successfully running:

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

but this statement:

Application.Run _

"BofQUtilities.xla!InDirect_Menu_Routines.ReNumber BofQPages(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.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.524 / Virus Database: 321 - Release Date: 06/10/2003





Stuart[_5_]

Problems running a sub having arguments
 
Thanks, but now a compile error ..."expected expression".

"Bob Phillips" wrote in message
...
Stuart,

Haven't tried it myself, but try

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


--

HTH

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

"Stuart" wrote in message
...
From the Immediate window, this statement:

Application.Run "BofQUtilities.xla!InDirect_Menu_Routines.Test 1"

results in the following macro successfully running:

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

but this statement:

Application.Run _

"BofQUtilities.xla!InDirect_Menu_Routines.ReNumber BofQPages(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.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.524 / Virus Database: 321 - Release Date: 06/10/2003






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.524 / Virus Database: 321 - Release Date: 07/10/2003



Stuart[_5_]

Problems running a sub having arguments
 
Thanks, but same error msg 1004.
Macro cannot be found.

Regards.

"S?ren Remfeldt" wrote in message
om...
Hi Stuart!
Try this instead
Application.Run _
"BofQUtilities.xla!InDirect_Menu_Routines.ReNumber BofQPages myCell,

ws,£Col
without the"()".....
It might work!
;-) Søren Remfeldt

"Stuart" wrote in message

...
From the Immediate window, this statement:

Application.Run "BofQUtilities.xla!InDirect_Menu_Routines.Test 1"

results in the following macro successfully running:

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

but this statement:

Application.Run _

"BofQUtilities.xla!InDirect_Menu_Routines.ReNumber BofQPages(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.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.524 / Virus Database: 321 - Release Date: 06/10/2003



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.524 / Virus Database: 321 - Release Date: 07/10/2003



Dave Peterson[_3_]

Problems running a sub having arguments
 
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.ReNumberBofQPage s", _
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


Stuart wrote:

From the Immediate window, this statement:

Application.Run "BofQUtilities.xla!InDirect_Menu_Routines.Test 1"

results in the following macro successfully running:

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

but this statement:

Application.Run _

"BofQUtilities.xla!InDirect_Menu_Routines.ReNumber BofQPages(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.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.524 / Virus Database: 321 - Release Date: 06/10/2003


--

Dave Peterson


Stuart[_5_]

Problems running a sub having arguments
 
The Run statement worked fine.

Many thanks.

Regards.

"Dave Peterson" wrote in message
...
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.ReNumberBofQPage s", _
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


Stuart wrote:

From the Immediate window, this statement:

Application.Run "BofQUtilities.xla!InDirect_Menu_Routines.Test 1"

results in the following macro successfully running:

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

but this statement:

Application.Run _

"BofQUtilities.xla!InDirect_Menu_Routines.ReNumber BofQPages(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.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.524 / Virus Database: 321 - Release Date: 06/10/2003


--

Dave Peterson



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.524 / Virus Database: 321 - Release Date: 06/10/2003




All times are GMT +1. The time now is 07:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com