+ Reply to Thread
Results 1 to 9 of 9

.onaction macro call won't work

  1. #1
    Guest

    .onaction macro call won't work

    Sorry for the crosspost, put it in the wrong forum.

    I created a custom toolbar first without code and
    attached macros to the buttons, and they worked fine.
    however, I had problems sharing the workbook with others;
    I followed some code posted here to create a toolbar in
    code, I used the .onaction property to assign the buttons
    to the same macros but they don't work - it says macro
    doesn't exist!!

    I noticed this difference - when it fails it says the
    macro "filename.xls!macroname" not found. But when I use
    the toolbar customize fature to assign the macro it's in
    the form "Thisworkbook!macroname". Looking for help!!

    Wayne

  2. #2
    Rob van Gelder
    Guest

    Re: .onaction macro call won't work

    I have commandbar examples on my website.

    Often your symptoms will occur when there is some sort of compile error.
    If the module doesn't compile, OnAction cannot find the macro to run.

    Perhaps there is a missing reference?

    --
    Rob van Gelder - http://www.vangelder.co.nz/excel


    <anonymous@discussions.microsoft.com> wrote in message
    news:2d5001c51ee3$56f3b9b0$a401280a@phx.gbl...
    > Sorry for the crosspost, put it in the wrong forum.
    >
    > I created a custom toolbar first without code and
    > attached macros to the buttons, and they worked fine.
    > however, I had problems sharing the workbook with others;
    > I followed some code posted here to create a toolbar in
    > code, I used the .onaction property to assign the buttons
    > to the same macros but they don't work - it says macro
    > doesn't exist!!
    >
    > I noticed this difference - when it fails it says the
    > macro "filename.xls!macroname" not found. But when I use
    > the toolbar customize fature to assign the macro it's in
    > the form "Thisworkbook!macroname". Looking for help!!
    >
    > Wayne




  3. #3
    Bob Phillips
    Guest

    Re: .onaction macro call won't work

    Are you sure that you put your macros in a standard code module, not one of
    the calls modules such as ThisWorkbook, or the sheet modules?

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    <anonymous@discussions.microsoft.com> wrote in message
    news:2d5001c51ee3$56f3b9b0$a401280a@phx.gbl...
    > Sorry for the crosspost, put it in the wrong forum.
    >
    > I created a custom toolbar first without code and
    > attached macros to the buttons, and they worked fine.
    > however, I had problems sharing the workbook with others;
    > I followed some code posted here to create a toolbar in
    > code, I used the .onaction property to assign the buttons
    > to the same macros but they don't work - it says macro
    > doesn't exist!!
    >
    > I noticed this difference - when it fails it says the
    > macro "filename.xls!macroname" not found. But when I use
    > the toolbar customize fature to assign the macro it's in
    > the form "Thisworkbook!macroname". Looking for help!!
    >
    > Wayne




  4. #4
    Wayne
    Guest

    Re: .onaction macro call won't work

    I did put it in th4 ThisWorkbook module. I don't have a
    clear understanding yet of what goes where! Obviously...

    So that was a mistake? :-)

    Wayne
    >-----Original Message-----
    >Are you sure that you put your macros in a standard code

    module, not one of
    >the calls modules such as ThisWorkbook, or the sheet

    modules?
    >
    >--
    >
    >HTH
    >
    >RP
    >(remove nothere from the email address if mailing direct)
    >
    >
    ><anonymous@discussions.microsoft.com> wrote in message
    >news:2d5001c51ee3$56f3b9b0$a401280a@phx.gbl...
    >> Sorry for the crosspost, put it in the wrong forum.
    >>
    >> I created a custom toolbar first without code and
    >> attached macros to the buttons, and they worked fine.
    >> however, I had problems sharing the workbook with

    others;
    >> I followed some code posted here to create a toolbar in
    >> code, I used the .onaction property to assign the

    buttons
    >> to the same macros but they don't work - it says macro
    >> doesn't exist!!
    >>
    >> I noticed this difference - when it fails it says the
    >> macro "filename.xls!macroname" not found. But when I

    use
    >> the toolbar customize fature to assign the macro it's

    in
    >> the form "Thisworkbook!macroname". Looking for help!!
    >>
    >> Wayne

    >
    >
    >.
    >


  5. #5
    Bob Phillips
    Guest

    Re: .onaction macro call won't work

    Yes it was. Put it in a standard code module and re-assign the macros to the
    buttons.

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Wayne" <anonymous@discussions.microsoft.com> wrote in message
    news:209401c51f3d$8407d8a0$a501280a@phx.gbl...
    > I did put it in th4 ThisWorkbook module. I don't have a
    > clear understanding yet of what goes where! Obviously...
    >
    > So that was a mistake? :-)
    >
    > Wayne
    > >-----Original Message-----
    > >Are you sure that you put your macros in a standard code

    > module, not one of
    > >the calls modules such as ThisWorkbook, or the sheet

    > modules?
    > >
    > >--
    > >
    > >HTH
    > >
    > >RP
    > >(remove nothere from the email address if mailing direct)
    > >
    > >
    > ><anonymous@discussions.microsoft.com> wrote in message
    > >news:2d5001c51ee3$56f3b9b0$a401280a@phx.gbl...
    > >> Sorry for the crosspost, put it in the wrong forum.
    > >>
    > >> I created a custom toolbar first without code and
    > >> attached macros to the buttons, and they worked fine.
    > >> however, I had problems sharing the workbook with

    > others;
    > >> I followed some code posted here to create a toolbar in
    > >> code, I used the .onaction property to assign the

    > buttons
    > >> to the same macros but they don't work - it says macro
    > >> doesn't exist!!
    > >>
    > >> I noticed this difference - when it fails it says the
    > >> macro "filename.xls!macroname" not found. But when I

    > use
    > >> the toolbar customize fature to assign the macro it's

    > in
    > >> the form "Thisworkbook!macroname". Looking for help!!
    > >>
    > >> Wayne

    > >
    > >
    > >.
    > >




  6. #6
    Wayne
    Guest

    Re: .onaction macro call won't work

    Thanks will do.

    But another related question. Where should you store
    global varaible declarations and assignments? I put them
    in the workbook On_open event handler. Is that correct?

    Wayne
    >-----Original Message-----
    >Yes it was. Put it in a standard code module and re-

    assign the macros to the
    >buttons.
    >
    >--
    >
    >HTH
    >
    >RP
    >(remove nothere from the email address if mailing direct)
    >
    >
    >"Wayne" <anonymous@discussions.microsoft.com> wrote in

    message
    >news:209401c51f3d$8407d8a0$a501280a@phx.gbl...
    >> I did put it in th4 ThisWorkbook module. I don't have a
    >> clear understanding yet of what goes where!

    Obviously...
    >>
    >> So that was a mistake? :-)
    >>
    >> Wayne
    >> >-----Original Message-----
    >> >Are you sure that you put your macros in a standard

    code
    >> module, not one of
    >> >the calls modules such as ThisWorkbook, or the sheet

    >> modules?
    >> >
    >> >--
    >> >
    >> >HTH
    >> >
    >> >RP
    >> >(remove nothere from the email address if mailing

    direct)
    >> >
    >> >
    >> ><anonymous@discussions.microsoft.com> wrote in message
    >> >news:2d5001c51ee3$56f3b9b0$a401280a@phx.gbl...
    >> >> Sorry for the crosspost, put it in the wrong forum.
    >> >>
    >> >> I created a custom toolbar first without code and
    >> >> attached macros to the buttons, and they worked

    fine.
    >> >> however, I had problems sharing the workbook with

    >> others;
    >> >> I followed some code posted here to create a

    toolbar in
    >> >> code, I used the .onaction property to assign the

    >> buttons
    >> >> to the same macros but they don't work - it says

    macro
    >> >> doesn't exist!!
    >> >>
    >> >> I noticed this difference - when it fails it says

    the
    >> >> macro "filename.xls!macroname" not found. But when I

    >> use
    >> >> the toolbar customize fature to assign the macro

    it's
    >> in
    >> >> the form "Thisworkbook!macroname". Looking for

    help!!
    >> >>
    >> >> Wayne
    >> >
    >> >
    >> >.
    >> >

    >
    >
    >.
    >


  7. #7
    Bob Phillips
    Guest

    Re: .onaction macro call won't work

    What do you mean by global variable declarations and assignments?

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Wayne" <anonymous@discussions.microsoft.com> wrote in message
    news:381701c51f7f$6c99bed0$a601280a@phx.gbl...
    > Thanks will do.
    >
    > But another related question. Where should you store
    > global varaible declarations and assignments? I put them
    > in the workbook On_open event handler. Is that correct?
    >
    > Wayne
    > >-----Original Message-----
    > >Yes it was. Put it in a standard code module and re-

    > assign the macros to the
    > >buttons.
    > >
    > >--
    > >
    > >HTH
    > >
    > >RP
    > >(remove nothere from the email address if mailing direct)
    > >
    > >
    > >"Wayne" <anonymous@discussions.microsoft.com> wrote in

    > message
    > >news:209401c51f3d$8407d8a0$a501280a@phx.gbl...
    > >> I did put it in th4 ThisWorkbook module. I don't have a
    > >> clear understanding yet of what goes where!

    > Obviously...
    > >>
    > >> So that was a mistake? :-)
    > >>
    > >> Wayne
    > >> >-----Original Message-----
    > >> >Are you sure that you put your macros in a standard

    > code
    > >> module, not one of
    > >> >the calls modules such as ThisWorkbook, or the sheet
    > >> modules?
    > >> >
    > >> >--
    > >> >
    > >> >HTH
    > >> >
    > >> >RP
    > >> >(remove nothere from the email address if mailing

    > direct)
    > >> >
    > >> >
    > >> ><anonymous@discussions.microsoft.com> wrote in message
    > >> >news:2d5001c51ee3$56f3b9b0$a401280a@phx.gbl...
    > >> >> Sorry for the crosspost, put it in the wrong forum.
    > >> >>
    > >> >> I created a custom toolbar first without code and
    > >> >> attached macros to the buttons, and they worked

    > fine.
    > >> >> however, I had problems sharing the workbook with
    > >> others;
    > >> >> I followed some code posted here to create a

    > toolbar in
    > >> >> code, I used the .onaction property to assign the
    > >> buttons
    > >> >> to the same macros but they don't work - it says

    > macro
    > >> >> doesn't exist!!
    > >> >>
    > >> >> I noticed this difference - when it fails it says

    > the
    > >> >> macro "filename.xls!macroname" not found. But when I
    > >> use
    > >> >> the toolbar customize fature to assign the macro

    > it's
    > >> in
    > >> >> the form "Thisworkbook!macroname". Looking for

    > help!!
    > >> >>
    > >> >> Wayne
    > >> >
    > >> >
    > >> >.
    > >> >

    > >
    > >
    > >.
    > >




  8. #8
    Wayne
    Guest

    Re: .onaction macro call won't work

    Option explicit
    dim file1, file2 as string
    file1 = "pathtofile1)
    file2 = "pathtofile2"

    etc. Variables I want to use in a number of macros and
    don't change

    Wayne



    >-----Original Message-----
    >What do you mean by global variable declarations and

    assignments?
    >
    >--
    >
    >HTH
    >
    >RP
    >(remove nothere from the email address if mailing direct)
    >
    >
    >"Wayne" <anonymous@discussions.microsoft.com> wrote in

    message
    >news:381701c51f7f$6c99bed0$a601280a@phx.gbl...
    >> Thanks will do.
    >>
    >> But another related question. Where should you store
    >> global varaible declarations and assignments? I put

    them
    >> in the workbook On_open event handler. Is that correct?
    >>
    >> Wayne
    >> >-----Original Message-----
    >> >Yes it was. Put it in a standard code module and re-

    >> assign the macros to the
    >> >buttons.
    >> >
    >> >--
    >> >
    >> >HTH
    >> >
    >> >RP
    >> >(remove nothere from the email address if mailing

    direct)
    >> >
    >> >
    >> >"Wayne" <anonymous@discussions.microsoft.com> wrote in

    >> message
    >> >news:209401c51f3d$8407d8a0$a501280a@phx.gbl...
    >> >> I did put it in th4 ThisWorkbook module. I don't

    have a
    >> >> clear understanding yet of what goes where!

    >> Obviously...
    >> >>
    >> >> So that was a mistake? :-)
    >> >>
    >> >> Wayne
    >> >> >-----Original Message-----
    >> >> >Are you sure that you put your macros in a standard

    >> code
    >> >> module, not one of
    >> >> >the calls modules such as ThisWorkbook, or the

    sheet
    >> >> modules?
    >> >> >
    >> >> >--
    >> >> >
    >> >> >HTH
    >> >> >
    >> >> >RP
    >> >> >(remove nothere from the email address if mailing

    >> direct)
    >> >> >
    >> >> >
    >> >> ><anonymous@discussions.microsoft.com> wrote in

    message
    >> >> >news:2d5001c51ee3$56f3b9b0$a401280a@phx.gbl...
    >> >> >> Sorry for the crosspost, put it in the wrong

    forum.
    >> >> >>
    >> >> >> I created a custom toolbar first without code and
    >> >> >> attached macros to the buttons, and they worked

    >> fine.
    >> >> >> however, I had problems sharing the workbook with
    >> >> others;
    >> >> >> I followed some code posted here to create a

    >> toolbar in
    >> >> >> code, I used the .onaction property to assign the
    >> >> buttons
    >> >> >> to the same macros but they don't work - it says

    >> macro
    >> >> >> doesn't exist!!
    >> >> >>
    >> >> >> I noticed this difference - when it fails it says

    >> the
    >> >> >> macro "filename.xls!macroname" not found. But

    when I
    >> >> use
    >> >> >> the toolbar customize fature to assign the macro

    >> it's
    >> >> in
    >> >> >> the form "Thisworkbook!macroname". Looking for

    >> help!!
    >> >> >>
    >> >> >> Wayne
    >> >> >
    >> >> >
    >> >> >.
    >> >> >
    >> >
    >> >
    >> >.
    >> >

    >
    >
    >.
    >


  9. #9
    Bob Phillips
    Guest

    Re: .onaction macro call won't work

    It is fine to put them in the Workbook_Open event, but declare them in a
    standard code module, else they will be local to ThisWorkbook.

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Wayne" <anonymous@discussions.microsoft.com> wrote in message
    news:396501c51fb1$5b50c6a0$a601280a@phx.gbl...
    > Option explicit
    > dim file1, file2 as string
    > file1 = "pathtofile1)
    > file2 = "pathtofile2"
    >
    > etc. Variables I want to use in a number of macros and
    > don't change
    >
    > Wayne
    >
    >
    >
    > >-----Original Message-----
    > >What do you mean by global variable declarations and

    > assignments?
    > >
    > >--
    > >
    > >HTH
    > >
    > >RP
    > >(remove nothere from the email address if mailing direct)
    > >
    > >
    > >"Wayne" <anonymous@discussions.microsoft.com> wrote in

    > message
    > >news:381701c51f7f$6c99bed0$a601280a@phx.gbl...
    > >> Thanks will do.
    > >>
    > >> But another related question. Where should you store
    > >> global varaible declarations and assignments? I put

    > them
    > >> in the workbook On_open event handler. Is that correct?
    > >>
    > >> Wayne
    > >> >-----Original Message-----
    > >> >Yes it was. Put it in a standard code module and re-
    > >> assign the macros to the
    > >> >buttons.
    > >> >
    > >> >--
    > >> >
    > >> >HTH
    > >> >
    > >> >RP
    > >> >(remove nothere from the email address if mailing

    > direct)
    > >> >
    > >> >
    > >> >"Wayne" <anonymous@discussions.microsoft.com> wrote in
    > >> message
    > >> >news:209401c51f3d$8407d8a0$a501280a@phx.gbl...
    > >> >> I did put it in th4 ThisWorkbook module. I don't

    > have a
    > >> >> clear understanding yet of what goes where!
    > >> Obviously...
    > >> >>
    > >> >> So that was a mistake? :-)
    > >> >>
    > >> >> Wayne
    > >> >> >-----Original Message-----
    > >> >> >Are you sure that you put your macros in a standard
    > >> code
    > >> >> module, not one of
    > >> >> >the calls modules such as ThisWorkbook, or the

    > sheet
    > >> >> modules?
    > >> >> >
    > >> >> >--
    > >> >> >
    > >> >> >HTH
    > >> >> >
    > >> >> >RP
    > >> >> >(remove nothere from the email address if mailing
    > >> direct)
    > >> >> >
    > >> >> >
    > >> >> ><anonymous@discussions.microsoft.com> wrote in

    > message
    > >> >> >news:2d5001c51ee3$56f3b9b0$a401280a@phx.gbl...
    > >> >> >> Sorry for the crosspost, put it in the wrong

    > forum.
    > >> >> >>
    > >> >> >> I created a custom toolbar first without code and
    > >> >> >> attached macros to the buttons, and they worked
    > >> fine.
    > >> >> >> however, I had problems sharing the workbook with
    > >> >> others;
    > >> >> >> I followed some code posted here to create a
    > >> toolbar in
    > >> >> >> code, I used the .onaction property to assign the
    > >> >> buttons
    > >> >> >> to the same macros but they don't work - it says
    > >> macro
    > >> >> >> doesn't exist!!
    > >> >> >>
    > >> >> >> I noticed this difference - when it fails it says
    > >> the
    > >> >> >> macro "filename.xls!macroname" not found. But

    > when I
    > >> >> use
    > >> >> >> the toolbar customize fature to assign the macro
    > >> it's
    > >> >> in
    > >> >> >> the form "Thisworkbook!macroname". Looking for
    > >> help!!
    > >> >> >>
    > >> >> >> Wayne
    > >> >> >
    > >> >> >
    > >> >> >.
    > >> >> >
    > >> >
    > >> >
    > >> >.
    > >> >

    > >
    > >
    > >.
    > >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1