Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Application.Run Method

I have been using the Application.Run method for a long time, and
thought I was familiar with its syntax, namely :

Application.Run AnotherSub
Application.Run ("Add-In Name!Macro Name")
Application.Run "'Some book.xls'!TheMacro"

However, I need to pass some arguments to another procedure, and the
only way I can get it to work is as follows (transferring a string
variable from the 1st sub to the called sub) :

Application.Run "AnotherSub", My_Procedure_Name

It fails if I try what I expected, ie with the ( )

Application.Run ("AnotherSub", My_Procedure_Name)

But works if I use

Result = Application.Run ("AnotherSub ", My_Procedure_Name)

Now this isn't too important (hey, it works after I spent a lot of
time experimenting and searching the Goggle Groups), but am I missing
something? The Excel help indicates that the ( ) are required.

Any comments would be welcome in order to broaden my mind!

Regards,

Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default re; Application.Run Method

Try it without the brackets
I use the following line of code to run a macro in another
workbook.

Application.Run "ACM_Excel_Interface.xls!
UpdateCallerList", ThisWorkbook.Name

so passing the calling workbook's name to the
UpdateCallerList procedure. No value is returned.

Kevin Beckham

-----Original Message-----
I have been using the Application.Run method for a long

time, and
thought I was familiar with its syntax, namely :

Application.Run AnotherSub
Application.Run ("Add-In Name!Macro Name")
Application.Run "'Some book.xls'!TheMacro"

However, I need to pass some arguments to another

procedure, and the
only way I can get it to work is as follows (transferring

a string
variable from the 1st sub to the called sub) :

Application.Run "AnotherSub", My_Procedure_Name

It fails if I try what I expected, ie with the ( )

Application.Run ("AnotherSub", My_Procedure_Name)

But works if I use

Result = Application.Run ("AnotherSub ",

My_Procedure_Name)

Now this isn't too important (hey, it works after I spent

a lot of
time experimenting and searching the Goggle Groups), but

am I missing
something? The Excel help indicates that the ( ) are

required.

Any comments would be welcome in order to broaden my mind!

Regards,

Mark
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Application.Run Method

You are misreading the help.

VBA syntax is that you do not use parentheses when you provide arguments to
a Subroutine unless you preface it with the call command. You do use them
with a function if the function is returning a value. You don't use them
with a function if you are not using the returned value.

In help, all procedures are shown with the arguments in parentheses, but
this is not intended to say that you need to use parentheses - it is just a
typographical convention they are using.

--
Regards,
Tom Ogilvy

"Mark Worthington" wrote in message
om...
I have been using the Application.Run method for a long time, and
thought I was familiar with its syntax, namely :

Application.Run AnotherSub
Application.Run ("Add-In Name!Macro Name")
Application.Run "'Some book.xls'!TheMacro"

However, I need to pass some arguments to another procedure, and the
only way I can get it to work is as follows (transferring a string
variable from the 1st sub to the called sub) :

Application.Run "AnotherSub", My_Procedure_Name

It fails if I try what I expected, ie with the ( )

Application.Run ("AnotherSub", My_Procedure_Name)

But works if I use

Result = Application.Run ("AnotherSub ", My_Procedure_Name)

Now this isn't too important (hey, it works after I spent a lot of
time experimenting and searching the Goggle Groups), but am I missing
something? The Excel help indicates that the ( ) are required.

Any comments would be welcome in order to broaden my mind!

Regards,

Mark



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Application.Run Method

Tom,

A voice of understanding in the darkness!

Thanks for your help,

Mark


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply
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
Please post this thread a correct full method, method about Nast Runsome New Users to Excel 8 February 25th 08 03:29 PM
Please post this thread a complete correct method, method about te Nast Runsome New Users to Excel 0 February 23rd 08 09:42 PM
macro to close excel application other than application.quit mary Excel Programming 1 September 14th 04 03:43 PM
application.quit will not shut off application john Excel Programming 0 January 9th 04 11:29 PM
Making VB PasteSpecial method to work the same as Excels Application John[_35_] Excel Programming 1 July 10th 03 05:20 PM


All times are GMT +1. The time now is 10:51 AM.

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

About Us

"It's about Microsoft Excel"