+ Reply to Thread
Results 1 to 2 of 2

.OnAction points to wrong file.module.procedure

  1. #1
    Datasort
    Guest

    .OnAction points to wrong file.module.procedure

    I have a problem with a reference for the .OnAction of a command bar button.

    There are two excel workbooks open. One is an XLA that is the code for the
    other workbook. In each workbook there is a module called reports and a sub
    called GenerateReports. The full index to the code is Reports.GenerateReports

    The workbooks are names.

    Plan1.xls
    PlanCode.xla


    The OnAction is set to the code below:

    .. OnAction = PlanCode.xla!Reports.GenerateReports


    The problem is that the code that is being run is.

    Plan1.xls!Reports.GenerateReports not the .XLA file.

    I can’t seem to run the code in the xla version or Reports.GenerateReports

    Other considerations:

    The .xla file has the property isAddIn is set to true. Thus the workbook in
    not visible.

    I would also prefer not to rename either Module.Procedure name

    I am running Office10 (Excel XP)

    Any thought/solutions would be appreciated

    --
    Stewart Rogers
    DataSort Software, L.C.

  2. #2
    Rob Bovey
    Guest

    Re: .OnAction points to wrong file.module.procedure

    Hi Stewart,

    Unfortunately, this is a known problem with the OnAction setting of
    command bar controls. If two workbooks have the same procedure name, a
    command bar control with its OnAction property assigned to that procedure
    name will run the procedure in which ever workbook was opened last.
    Qualifying the procedure name with the workbook name when setting the
    OnAction property doesn't help. The only workaround is to make sure your
    procedures are uniquely named.

    --
    Rob Bovey, Excel MVP
    Application Professionals
    http://www.appspro.com/

    * Take your Excel development skills to the next level.
    * Professional Excel Development
    http://www.appspro.com/Books/Books.htm

    "Datasort" <Datasort@discussions.microsoft.com> wrote in message
    news:D7A68AE1-DCF5-4D65-87F9-F5A26CAD11A6@microsoft.com...
    >I have a problem with a reference for the .OnAction of a command bar
    >button.
    >
    > There are two excel workbooks open. One is an XLA that is the code for the
    > other workbook. In each workbook there is a module called reports and a
    > sub
    > called GenerateReports. The full index to the code is
    > Reports.GenerateReports
    >
    > The workbooks are names.
    >
    > Plan1.xls
    > PlanCode.xla
    >
    >
    > The OnAction is set to the code below:
    >
    > . OnAction = PlanCode.xla!Reports.GenerateReports
    >
    >
    > The problem is that the code that is being run is.
    >
    > Plan1.xls!Reports.GenerateReports not the .XLA file.
    >
    > I can't seem to run the code in the xla version or Reports.GenerateReports
    >
    > Other considerations:
    >
    > The .xla file has the property isAddIn is set to true. Thus the workbook
    > in
    > not visible.
    >
    > I would also prefer not to rename either Module.Procedure name
    >
    > I am running Office10 (Excel XP)
    >
    > Any thought/solutions would be appreciated
    >
    > --
    > Stewart Rogers
    > DataSort Software, L.C.




+ 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