Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Call Procedure

In Workbook A I have procedures that execute and then it opens Workbook B. I
now need to run procedures in workbook B.

The name "Workbook B" that Workbook A uses to open Workbook B is in Cell A1.
There are numerous workbooks that Workbook A Opens based on the name in cell
A1.

What I need is a way to call the procudures in the Workbook being opened
based on name in Cell A1.

I have tried...
Application.Run "'(Range("a1").Value)'!MySub"
Call (Range("a1").Value).MyModule.MySub

But can not get it to work.

Any help will be truly appreciated.

Regards,




I need a way of calling the procdures based upon various workbooks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Call Procedure

With ThisWorkbook.Worksheets("Sheet1")
Application.Run "'" & .Range("a1").Value & "'!MySub"
End with
--
Regards,
Tom Ogilvy

"Ronbo" wrote in message
...
In Workbook A I have procedures that execute and then it opens Workbook B.

I
now need to run procedures in workbook B.

The name "Workbook B" that Workbook A uses to open Workbook B is in Cell

A1.
There are numerous workbooks that Workbook A Opens based on the name in

cell
A1.

What I need is a way to call the procudures in the Workbook being opened
based on name in Cell A1.

I have tried...
Application.Run "'(Range("a1").Value)'!MySub"
Call (Range("a1").Value).MyModule.MySub

But can not get it to work.

Any help will be truly appreciated.

Regards,




I need a way of calling the procdures based upon various workbooks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Call Procedure

Thanks alot for your help. However I am stilling doing something wrong. What
I have is the following Sub in Workbook A:

Sub OpenRunReport()
'
Workbooks.Open (Range("a1").Value)

With ThisWorkbook.Worksheets("sheet1")
Application.Run "'" & .Range("a1").Value & "'!MySub"
End With

End Sub

It opens and goes to WorkBook B but it gives me an 1004 Run-time error
(0.953543...xls could not be found). Cell A1 in Workbook A contains the full
path and filename. If I use cell B1 with just the file name it gives me an
error that the macro can not be found.

Any ideas what I am doing wrong?

Thanks,
Ronbo




"Tom Ogilvy" wrote:

With ThisWorkbook.Worksheets("Sheet1")
Application.Run "'" & .Range("a1").Value & "'!MySub"
End with
--
Regards,
Tom Ogilvy

"Ronbo" wrote in message
...
In Workbook A I have procedures that execute and then it opens Workbook B.

I
now need to run procedures in workbook B.

The name "Workbook B" that Workbook A uses to open Workbook B is in Cell

A1.
There are numerous workbooks that Workbook A Opens based on the name in

cell
A1.

What I need is a way to call the procudures in the Workbook being opened
based on name in Cell A1.

I have tried...
Application.Run "'(Range("a1").Value)'!MySub"
Call (Range("a1").Value).MyModule.MySub

But can not get it to work.

Any help will be truly appreciated.

Regards,




I need a way of calling the procdures based upon various workbooks.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Call Procedure

is Sheet1 in WorkbookA the activesheet when you run the macro?

If not, I told it specifically to get the value from Sheet1. Adjust the
sheet name to point to the correct sheet.

If A1 contains Myworkbook.xls

then it should work.

If A1 includes the path and B1 shows MyWorkbook.xls, then use B1.

If you hard code the name and it says it can't find the macro, then make
sure the macro is in a general module, not a sheet module or the
thisworkbook module or a class module.


--
Regards,
Tom Ogilvy


"Ronbo" wrote in message
...
Thanks alot for your help. However I am stilling doing something wrong.

What
I have is the following Sub in Workbook A:

Sub OpenRunReport()
'
Workbooks.Open (Range("a1").Value)

With ThisWorkbook.Worksheets("sheet1")
Application.Run "'" & .Range("a1").Value & "'!MySub"
End With

End Sub

It opens and goes to WorkBook B but it gives me an 1004 Run-time error
(0.953543...xls could not be found). Cell A1 in Workbook A contains the

full
path and filename. If I use cell B1 with just the file name it gives me

an
error that the macro can not be found.

Any ideas what I am doing wrong?

Thanks,
Ronbo




"Tom Ogilvy" wrote:

With ThisWorkbook.Worksheets("Sheet1")
Application.Run "'" & .Range("a1").Value & "'!MySub"
End with
--
Regards,
Tom Ogilvy

"Ronbo" wrote in message
...
In Workbook A I have procedures that execute and then it opens

Workbook B.
I
now need to run procedures in workbook B.

The name "Workbook B" that Workbook A uses to open Workbook B is in

Cell
A1.
There are numerous workbooks that Workbook A Opens based on the name

in
cell
A1.

What I need is a way to call the procudures in the Workbook being

opened
based on name in Cell A1.

I have tried...
Application.Run "'(Range("a1").Value)'!MySub"
Call (Range("a1").Value).MyModule.MySub

But can not get it to work.

Any help will be truly appreciated.

Regards,




I need a way of calling the procdures based upon various workbooks.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Call Procedure

You were exactly right... I was on "sheet2". Changing it "sheet2", it now
works perfect.

Thanks alot for you help.

Regards,
Ronbo

"Tom Ogilvy" wrote:

is Sheet1 in WorkbookA the activesheet when you run the macro?

If not, I told it specifically to get the value from Sheet1. Adjust the
sheet name to point to the correct sheet.

If A1 contains Myworkbook.xls

then it should work.

If A1 includes the path and B1 shows MyWorkbook.xls, then use B1.

If you hard code the name and it says it can't find the macro, then make
sure the macro is in a general module, not a sheet module or the
thisworkbook module or a class module.


--
Regards,
Tom Ogilvy


"Ronbo" wrote in message
...
Thanks alot for your help. However I am stilling doing something wrong.

What
I have is the following Sub in Workbook A:

Sub OpenRunReport()
'
Workbooks.Open (Range("a1").Value)

With ThisWorkbook.Worksheets("sheet1")
Application.Run "'" & .Range("a1").Value & "'!MySub"
End With

End Sub

It opens and goes to WorkBook B but it gives me an 1004 Run-time error
(0.953543...xls could not be found). Cell A1 in Workbook A contains the

full
path and filename. If I use cell B1 with just the file name it gives me

an
error that the macro can not be found.

Any ideas what I am doing wrong?

Thanks,
Ronbo




"Tom Ogilvy" wrote:

With ThisWorkbook.Worksheets("Sheet1")
Application.Run "'" & .Range("a1").Value & "'!MySub"
End with
--
Regards,
Tom Ogilvy

"Ronbo" wrote in message
...
In Workbook A I have procedures that execute and then it opens

Workbook B.
I
now need to run procedures in workbook B.

The name "Workbook B" that Workbook A uses to open Workbook B is in

Cell
A1.
There are numerous workbooks that Workbook A Opens based on the name

in
cell
A1.

What I need is a way to call the procudures in the Workbook being

opened
based on name in Cell A1.

I have tried...
Application.Run "'(Range("a1").Value)'!MySub"
Call (Range("a1").Value).MyModule.MySub

But can not get it to work.

Any help will be truly appreciated.

Regards,




I need a way of calling the procdures based upon various workbooks.






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
call procedure problem stan Excel Discussion (Misc queries) 2 August 17th 09 06:11 PM
Where else to look for procedure call Lulu Excel Programming 0 November 24th 04 03:07 PM
Where else to look for procedure call Lulu Excel Programming 2 November 24th 04 02:14 AM
call procedure bob Excel Programming 1 August 9th 03 12:40 AM
procedure won't call John Gittins Excel Programming 0 August 5th 03 08:17 PM


All times are GMT +1. The time now is 04:42 PM.

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

About Us

"It's about Microsoft Excel"