PC Review


Reply
Thread Tools Rate Thread

application run - macros within macros

 
 
=?Utf-8?B?U1lCUw==?=
Guest
Posts: n/a
 
      20th Apr 2007
Hi there,

I have a number of macros that I want to be activated in a series by
attaching them all to one 'button' on the work sheet they relate to.

That works fine to start with but because the workbook will be opened and
then saved with a different name by users, the "Application run ......xls
..Sheet13."macroname" approach means an error message about not finding the
macro. How do I code this so that the macros can be found whatever the user
names the book after opening it.

Thanks

Sybs

 
Reply With Quote
 
 
 
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      20th Apr 2007
If all the macro (subroutines) are in one workbook, then just ue the call
mysub(parm1,parrm2,...). No workbook references are required.

"SYBS" wrote:

> Hi there,
>
> I have a number of macros that I want to be activated in a series by
> attaching them all to one 'button' on the work sheet they relate to.
>
> That works fine to start with but because the workbook will be opened and
> then saved with a different name by users, the "Application run ......xls
> .Sheet13."macroname" approach means an error message about not finding the
> macro. How do I code this so that the macros can be found whatever the user
> names the book after opening it.
>
> Thanks
>
> Sybs
>

 
Reply With Quote
 
=?Utf-8?B?U1lCUw==?=
Guest
Posts: n/a
 
      20th Apr 2007
Thanks Joel,

Sorry to be so thick, how do I phrase it?

As in this is what I presently have. Howe do I phrase it correctly?


'THIS IS THE MACRO THAT CALLS THE SUBS TO UPDATE THE RESULTS PAGE'


Sub UPDATERESULTSHEET()
ActiveSheet.Unprotect ("sybs")

Sheets("RESULTS").Select
Application.Run _
"'isa scoring programme 2007 VBA 1.xls'!Sheet9.postFootlockresultsmen"

Sheets("RESULTS").Select
Application.Run _
"'isa scoring programme 2007 VBA 1.xls'!Sheet9.postthrowresultsmen"

Sheets("RESULTS").Select
Application.Run _
"'isa scoring programme 2007 VBA
1.xls'!Sheet9.postSpeedclimbresultsmen"
"Joel" wrote:

> If all the macro (subroutines) are in one workbook, then just ue the call
> mysub(parm1,parrm2,...). No workbook references are required.
> thanks so much for the help appreciated.


Sybs

> "SYBS" wrote:
>
> > Hi there,
> >
> > I have a number of macros that I want to be activated in a series by
> > attaching them all to one 'button' on the work sheet they relate to.
> >
> > That works fine to start with but because the workbook will be opened and
> > then saved with a different name by users, the "Application run ......xls
> > .Sheet13."macroname" approach means an error message about not finding the
> > macro. How do I code this so that the macros can be found whatever the user
> > names the book after opening it.
> >
> > Thanks
> >
> > Sybs
> >

 
Reply With Quote
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      20th Apr 2007

Application.Run _
"'isa scoring programme 2007 VBA
1.xls'!Sheet9.postFootlockresultsmen"

worrkbooks("'isa scoring programme 2007 VBA 1.xls").activate
sheets("Sheet9").activate
call postFootlockresultsmen()
call postthrowresultsmen()
call postSpeedclimbresultsmen()


when I have multiple subroutine I would do this

sub main()

call sub1(bob,joe)
call sub2(carrol)

end sub

sub sub1(parm1,parm2)


end sub
sub sub2(parm1)


end sub



"SYBS" wrote:

> Thanks Joel,
>
> Sorry to be so thick, how do I phrase it?
>
> As in this is what I presently have. Howe do I phrase it correctly?
>
>
> 'THIS IS THE MACRO THAT CALLS THE SUBS TO UPDATE THE RESULTS PAGE'
>
>
> Sub UPDATERESULTSHEET()
> ActiveSheet.Unprotect ("sybs")
>
> Sheets("RESULTS").Select
> Application.Run _
> "'isa scoring programme 2007 VBA 1.xls'!Sheet9.postFootlockresultsmen"
>
> Sheets("RESULTS").Select
> Application.Run _
> "'isa scoring programme 2007 VBA 1.xls'!Sheet9.postthrowresultsmen"
>
> Sheets("RESULTS").Select
> Application.Run _
> "'isa scoring programme 2007 VBA
> 1.xls'!Sheet9.postSpeedclimbresultsmen"
> "Joel" wrote:
>
> > If all the macro (subroutines) are in one workbook, then just ue the call
> > mysub(parm1,parrm2,...). No workbook references are required.
> > thanks so much for the help appreciated.

>
> Sybs
>
> > "SYBS" wrote:
> >
> > > Hi there,
> > >
> > > I have a number of macros that I want to be activated in a series by
> > > attaching them all to one 'button' on the work sheet they relate to.
> > >
> > > That works fine to start with but because the workbook will be opened and
> > > then saved with a different name by users, the "Application run ......xls
> > > .Sheet13."macroname" approach means an error message about not finding the
> > > macro. How do I code this so that the macros can be found whatever the user
> > > names the book after opening it.
> > >
> > > Thanks
> > >
> > > Sybs
> > >

 
Reply With Quote
 
=?Utf-8?B?U1lCUw==?=
Guest
Posts: n/a
 
      20th Apr 2007

Thanks so much, sorted. Great

Regards,

Sybs

"Joel" wrote:

>
> Application.Run _
> "'isa scoring programme 2007 VBA
> 1.xls'!Sheet9.postFootlockresultsmen"
>
> worrkbooks("'isa scoring programme 2007 VBA 1.xls").activate
> sheets("Sheet9").activate
> call postFootlockresultsmen()
> call postthrowresultsmen()
> call postSpeedclimbresultsmen()
>
>
> when I have multiple subroutine I would do this
>
> sub main()
>
> call sub1(bob,joe)
> call sub2(carrol)
>
> end sub
>
> sub sub1(parm1,parm2)
>
>
> end sub
> sub sub2(parm1)
>
>
> end sub
>
>
>
> "SYBS" wrote:
>
> > Thanks Joel,
> >
> > Sorry to be so thick, how do I phrase it?
> >
> > As in this is what I presently have. Howe do I phrase it correctly?
> >
> >
> > 'THIS IS THE MACRO THAT CALLS THE SUBS TO UPDATE THE RESULTS PAGE'
> >
> >
> > Sub UPDATERESULTSHEET()
> > ActiveSheet.Unprotect ("sybs")
> >
> > Sheets("RESULTS").Select
> > Application.Run _
> > "'isa scoring programme 2007 VBA 1.xls'!Sheet9.postFootlockresultsmen"
> >
> > Sheets("RESULTS").Select
> > Application.Run _
> > "'isa scoring programme 2007 VBA 1.xls'!Sheet9.postthrowresultsmen"
> >
> > Sheets("RESULTS").Select
> > Application.Run _
> > "'isa scoring programme 2007 VBA
> > 1.xls'!Sheet9.postSpeedclimbresultsmen"
> > "Joel" wrote:
> >
> > > If all the macro (subroutines) are in one workbook, then just ue the call
> > > mysub(parm1,parrm2,...). No workbook references are required.
> > > thanks so much for the help appreciated.

> >
> > Sybs
> >
> > > "SYBS" wrote:
> > >
> > > > Hi there,
> > > >
> > > > I have a number of macros that I want to be activated in a series by
> > > > attaching them all to one 'button' on the work sheet they relate to.
> > > >
> > > > That works fine to start with but because the workbook will be opened and
> > > > then saved with a different name by users, the "Application run ......xls
> > > > .Sheet13."macroname" approach means an error message about not finding the
> > > > macro. How do I code this so that the macros can be found whatever the user
> > > > names the book after opening it.
> > > >
> > > > Thanks
> > > >
> > > > Sybs
> > > >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macros in Personal.xls that would create two toolbars and buttonswith assigned macros =?Utf-8?B?SmF5?= Microsoft Excel Programming 1 30th Mar 2007 12:02 AM
choose default macros Not Enabled / Macros Enable Setting =?Utf-8?B?QkVFSkFZ?= Microsoft Excel Programming 2 30th Jun 2006 01:07 PM
weird saving of a document with macros resulting with macros being transfered to the copy alfonso gonzales Microsoft Excel Programming 0 12th Dec 2004 09:19 PM
Removing Excel message to enable macros or disable macros =?Utf-8?B?Ym1pbGxlcjI2Mw==?= Microsoft Excel Misc 2 13th Oct 2004 02:39 PM
Re: The macros in this project are disabled. Please refer to the online help or documentation of the host application to determine how to enable macros. Sue Mosher [MVP-Outlook] Microsoft Outlook Installation 0 17th Feb 2004 05:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:08 PM.