Re: Call Procedure
From: Ronbo (Ronbo_at_discussions.microsoft.com)
Date: 02/23/05
- Next message: MESTRELLA29: "Vlookup question"
- Previous message: Steve: "Re: Macros stay available"
- In reply to: Tom Ogilvy: "Re: Call Procedure"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 23 Feb 2005 12:11:02 -0800
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" <Ronbo@discussions.microsoft.com> wrote in message
> news:1EA56C7E-8A38-4574-9E7A-7C51AFD61F13@microsoft.com...
> > 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" <Ronbo@discussions.microsoft.com> wrote in message
> > > news:721223A7-8EE9-46FA-BD93-A1DF50013D74@microsoft.com...
> > > > 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.
> > >
> > >
> > >
>
>
>
- Next message: MESTRELLA29: "Vlookup question"
- Previous message: Steve: "Re: Macros stay available"
- In reply to: Tom Ogilvy: "Re: Call Procedure"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|