ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Running Macros (https://www.excelbanter.com/excel-programming/310568-running-macros.html)

steve

Running Macros
 
I am relatively new to VBA in Excel and am having trouble.
I am trying to call a macro in another workbook and pass a
parameter to that macro. Help does not provide a
reasonable explanation or Example to follow. I would
appreciate any help I can get in solving this problem!

TIA

Steve

No Name

Running Macros
 
hi,
is the other workbook open. if not then the macro will be
unavailable.
if is is open then try activing the workbook before you
pass the parameter to it.

workbooks(workbookname.xls).activate

-----Original Message-----
I am relatively new to VBA in Excel and am having

trouble.
I am trying to call a macro in another workbook and pass

a
parameter to that macro. Help does not provide a
reasonable explanation or Example to follow. I would
appreciate any help I can get in solving this problem!

TIA

Steve
.


steve

Running Macros
 
I tried this and am still having trouble. I have been
opening the file with the following:

Workbooks.Open fileName:="c:\dirName\filename"

This works to open the file. When I try the
application.run command, I get a run time error (1004):
Method 'Run' of object '_Application' failed

Thankyou in advance fore your help!

Steve
-----Original Message-----
hi,
is the other workbook open. if not then the macro will be
unavailable.
if is is open then try activing the workbook before you
pass the parameter to it.

workbooks(workbookname.xls).activate

-----Original Message-----
I am relatively new to VBA in Excel and am having

trouble.
I am trying to call a macro in another workbook and pass

a
parameter to that macro. Help does not provide a
reasonable explanation or Example to follow. I would
appreciate any help I can get in solving this problem!

TIA

Steve
.

.


steve

Running Macros
 
When I do open the file first using the workbooks.open
command I get a run-time error 9, Subscript out of Range
error when the workbooks(filename).activate command is
issued.

I know this probably is not as hard as it appears, but
none of the resources I have available provide a clear
example of what I need to do. I know my problem has to be
syntax, but MS Excel help and one other resource I have at
hand do not provide any real help!

Frustrated! Help!

Thanks!

Steve


-----Original Message-----
hi,
is the other workbook open. if not then the macro will be
unavailable.
if is is open then try activing the workbook before you
pass the parameter to it.

workbooks(workbookname.xls).activate

-----Original Message-----
I am relatively new to VBA in Excel and am having

trouble.
I am trying to call a macro in another workbook and pass

a
parameter to that macro. Help does not provide a
reasonable explanation or Example to follow. I would
appreciate any help I can get in solving this problem!

TIA

Steve
.

.


Dave Peterson[_3_]

Running Macros
 
How about:

dim wkbk as workbook
set wkbk = workbooks.open(filename:="c:\...\macro.xls")
Application.Run "'" & wkbk.Name & "'!module1.macro1"



Steve wrote:

When I do open the file first using the workbooks.open
command I get a run-time error 9, Subscript out of Range
error when the workbooks(filename).activate command is
issued.

I know this probably is not as hard as it appears, but
none of the resources I have available provide a clear
example of what I need to do. I know my problem has to be
syntax, but MS Excel help and one other resource I have at
hand do not provide any real help!

Frustrated! Help!

Thanks!

Steve

-----Original Message-----
hi,
is the other workbook open. if not then the macro will be
unavailable.
if is is open then try activing the workbook before you
pass the parameter to it.

workbooks(workbookname.xls).activate

-----Original Message-----
I am relatively new to VBA in Excel and am having

trouble.
I am trying to call a macro in another workbook and pass

a
parameter to that macro. Help does not provide a
reasonable explanation or Example to follow. I would
appreciate any help I can get in solving this problem!

TIA

Steve
.

.


--

Dave Peterson


steve

Running Macros
 
Thankyou! That helps a lot!!!
-----Original Message-----
How about:

dim wkbk as workbook
set wkbk = workbooks.open(filename:="c:\...\macro.xls")
Application.Run "'" & wkbk.Name & "'!module1.macro1"



Steve wrote:

When I do open the file first using the workbooks.open
command I get a run-time error 9, Subscript out of Range
error when the workbooks(filename).activate command is
issued.

I know this probably is not as hard as it appears, but
none of the resources I have available provide a clear
example of what I need to do. I know my problem has to

be
syntax, but MS Excel help and one other resource I have

at
hand do not provide any real help!

Frustrated! Help!

Thanks!

Steve

-----Original Message-----
hi,
is the other workbook open. if not then the macro will

be
unavailable.
if is is open then try activing the workbook before

you
pass the parameter to it.

workbooks(workbookname.xls).activate

-----Original Message-----
I am relatively new to VBA in Excel and am having
trouble.
I am trying to call a macro in another workbook and

pass
a
parameter to that macro. Help does not provide a
reasonable explanation or Example to follow. I would
appreciate any help I can get in solving this problem!

TIA

Steve
.

.


--

Dave Peterson

.



All times are GMT +1. The time now is 02:47 PM.

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