ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Probelm with Application.Run Method (https://www.excelbanter.com/excel-programming/395329-probelm-application-run-method.html)

[email protected]

Probelm with Application.Run Method
 
Hello,

I'm having difficulty calling a procedure from a separate workbook.
Right now I have

Application.Run "'S-Report.xls'!Time_Phase"

but I'm getting the error message "The macro "'S-Report.xls'!
Time_Phase" cannot be found."

Any ideas?


Thanks,

Calvin


Dave Peterson

Probelm with Application.Run Method
 
Is there a macro named Time_Phase in that S-Report.xls workbook's project?

Is s-report.xls open?



wrote:

Hello,

I'm having difficulty calling a procedure from a separate workbook.
Right now I have

Application.Run "'S-Report.xls'!Time_Phase"

but I'm getting the error message "The macro "'S-Report.xls'!
Time_Phase" cannot be found."

Any ideas?

Thanks,

Calvin


--

Dave Peterson

[email protected]

Probelm with Application.Run Method
 
On Aug 12, 8:57 pm, Dave Peterson wrote:
Is there a macro named Time_Phase in that S-Report.xls workbook's project?

Is s-report.xls open?





wrote:

Hello,


I'm having difficulty calling a procedure from a separate workbook.
Right now I have


Application.Run "'S-Report.xls'!Time_Phase"


but I'm getting the error message "The macro "'S-Report.xls'!
Time_Phase" cannot be found."


Any ideas?


Thanks,


Calvin


--

Dave Peterson- Hide quoted text -

- Show quoted text -


Dave,

I got it to work, I had to use "...Time_Phase.Time_Phase". (My guess
is because both the module and the procedure had the same name.)

I have another question:

The Time_Phase macro begins with a vbYesNo message box. Is it possible
to automatically select "Yes" when calling the Time_Phase macro
externally as I am?

Thanks,

Calvin


Jon Peltier

Probelm with Application.Run Method
 
You need to rewrite the macro to enable the dialog to be skipped. Perhaps
you could add an optional argument which runs the regular way if missing,
and runs without the dialog if present.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


wrote in message
oups.com...
On Aug 12, 8:57 pm, Dave Peterson wrote:
Is there a macro named Time_Phase in that S-Report.xls workbook's
project?

Is s-report.xls open?





wrote:

Hello,


I'm having difficulty calling a procedure from a separate workbook.
Right now I have


Application.Run "'S-Report.xls'!Time_Phase"


but I'm getting the error message "The macro "'S-Report.xls'!
Time_Phase" cannot be found."


Any ideas?


Thanks,


Calvin


--

Dave Peterson- Hide quoted text -

- Show quoted text -


Dave,

I got it to work, I had to use "...Time_Phase.Time_Phase". (My guess
is because both the module and the procedure had the same name.)

I have another question:

The Time_Phase macro begins with a vbYesNo message box. Is it possible
to automatically select "Yes" when calling the Time_Phase macro
externally as I am?

Thanks,

Calvin




[email protected]

Probelm with Application.Run Method
 
On Aug 12, 9:24 pm, "Jon Peltier"
wrote:
You need to rewrite the macro to enable the dialog to be skipped. Perhaps
you could add an optional argument which runs the regular way if missing,
and runs without the dialog if present.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. -http://PeltierTech.com
_______

wrote in message

oups.com...



On Aug 12, 8:57 pm, Dave Peterson wrote:
Is there a macro named Time_Phase in that S-Report.xls workbook's
project?


Is s-report.xls open?


wrote:


Hello,


I'm having difficulty calling a procedure from a separate workbook.
Right now I have


Application.Run "'S-Report.xls'!Time_Phase"


but I'm getting the error message "The macro "'S-Report.xls'!
Time_Phase" cannot be found."


Any ideas?


Thanks,


Calvin


--


Dave Peterson- Hide quoted text -


- Show quoted text -


Dave,


I got it to work, I had to use "...Time_Phase.Time_Phase". (My guess
is because both the module and the procedure had the same name.)


I have another question:


The Time_Phase macro begins with a vbYesNo message box. Is it possible
to automatically select "Yes" when calling the Time_Phase macro
externally as I am?


Thanks,


Calvin- Hide quoted text -


- Show quoted text -


I cannot alter the Time_Phase macro (the one being called externally).
Is there no way to automatically select "Yes" in an externally called
message box?


Peter T

Probelm with Application.Run Method
 
Following worked in a light test, but SendKeys can never be considered
reliable -

'should 'click' default button1
Application.SendKeys "{RETURN}"

' otherwise try
' Application.SendKeys "%y"
Application.Run "myBoook.xls!myMacro"

' in myBoook.xls
Sub myMacro()
Dim answer As VbMsgBoxResult

answer = MsgBox("Respond", vbYesNoCancel)

' also try following
' answer = MsgBox("Respond", vbYesNoCancel or vbDefaultButton3)


Select Case answer
Case vbYes
MsgBox "yes"
Case vbCancel
MsgBox "cancel"
Case vbNo
MsgBox "no"
End Select

End Sub

Regards,
Peter T

wrote in message
oups.com...
On Aug 12, 9:24 pm, "Jon Peltier"
wrote:
You need to rewrite the macro to enable the dialog to be skipped.

Perhaps
you could add an optional argument which runs the regular way if

missing,
and runs without the dialog if present.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. -http://PeltierTech.com
_______

wrote in message

oups.com...



On Aug 12, 8:57 pm, Dave Peterson wrote:
Is there a macro named Time_Phase in that S-Report.xls workbook's
project?


Is s-report.xls open?


wrote:


Hello,


I'm having difficulty calling a procedure from a separate workbook.
Right now I have


Application.Run "'S-Report.xls'!Time_Phase"


but I'm getting the error message "The macro "'S-Report.xls'!
Time_Phase" cannot be found."


Any ideas?


Thanks,


Calvin


--


Dave Peterson- Hide quoted text -


- Show quoted text -


Dave,


I got it to work, I had to use "...Time_Phase.Time_Phase". (My guess
is because both the module and the procedure had the same name.)


I have another question:


The Time_Phase macro begins with a vbYesNo message box. Is it possible
to automatically select "Yes" when calling the Time_Phase macro
externally as I am?


Thanks,


Calvin- Hide quoted text -


- Show quoted text -


I cannot alter the Time_Phase macro (the one being called externally).
Is there no way to automatically select "Yes" in an externally called
message box?





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

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