+ Reply to Thread
Results 1 to 2 of 2

Calling excel macro from VB 6 app problem

  1. #1
    C. Johnson
    Guest

    Calling excel macro from VB 6 app problem

    I am posting this question for a co-worker but know enough of the problem to
    be able to reply. Thanks for any help on this matter.

    We have an Excel plugin (MyPlugin.xla) in the XLStart folder. We need to run
    a public subroutine called MySub that is stored in the MyModule module from
    a VB6 program. We tried the following:

    Xapp.Application.Run "'MyPlugin.xla'!MyModule.MySub"

    This results in the following error message:

    Runtime error '1004': The macro 'MyPlugin.xla!MyModule.MySub' cannot be
    found.

    We've tried several combinations of syntax above with the following
    statements with similar results:

    Excel.AddIns.Add FileName:="C:\Program Files\Microsoft
    Office\OFFICE11\XLStart\MyPlugin.xla"

    AddIns("MyPlugin.xla").Installed = True

    and

    Xapp.Workbooks.Open FileName:="C:\Program Files\Microsoft
    Office\OFFICE11\XLStart\MyPlugin.xla"

    What is the correct way to run this macro?

    Thanks,

    David





  2. #2
    Tom Ogilvy
    Guest

    Re: Calling excel macro from VB 6 app problem

    You are correct, the addin has to be loaded (and it isn't by default if
    Excel is opened through automation). Then you would use the Run command you
    show.

    --
    Regards,
    Tom Ogilvy


    "C. Johnson" <dcjohnson8950@yahoo.com> wrote in message
    news:ejy4lUdxFHA.3124@TK2MSFTNGP12.phx.gbl...
    > I am posting this question for a co-worker but know enough of the problem

    to
    > be able to reply. Thanks for any help on this matter.
    >
    > We have an Excel plugin (MyPlugin.xla) in the XLStart folder. We need to

    run
    > a public subroutine called MySub that is stored in the MyModule module

    from
    > a VB6 program. We tried the following:
    >
    > Xapp.Application.Run "'MyPlugin.xla'!MyModule.MySub"
    >
    > This results in the following error message:
    >
    > Runtime error '1004': The macro 'MyPlugin.xla!MyModule.MySub' cannot be
    > found.
    >
    > We've tried several combinations of syntax above with the following
    > statements with similar results:
    >
    > Excel.AddIns.Add FileName:="C:\Program Files\Microsoft
    > Office\OFFICE11\XLStart\MyPlugin.xla"
    >
    > AddIns("MyPlugin.xla").Installed = True
    >
    > and
    >
    > Xapp.Workbooks.Open FileName:="C:\Program Files\Microsoft
    > Office\OFFICE11\XLStart\MyPlugin.xla"
    >
    > What is the correct way to run this macro?
    >
    > Thanks,
    >
    > David
    >
    >
    >
    >




+ 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