Cannot run macro from add-in.
Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Cannot run macro from add-in.

  1. #11
    New Member
    Join Date
    Jul 2019
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Cannot run macro from add-in.

    Still trying to understand all the details of your reply:

    Quote Originally Posted by ZVI View Post
    ...AddIn should not be with XLSM extension
    As I said, that was my mistake, the add-in is installed with the .xlam extension.

    looks like XLA(M) AddIn was saved as macro enabled workbook XLSM which works differently. For example, public User Defined Functions (UDFs) of the installed AddIn are accessible for any workbooks, but UDFs of XLSM are for only that macro enabled workbook.
    The "Open_xxxx" Subs are Subs, not Functions -- I do not know if it makes any difference. The Subs which are not found are declared as Public in the code in the add-in.xlam. Are you saying that they should be available to any Workbook in the Project simply by calling "Open_xxxx", that is without needing to use "Run AddIn.xlam!Open_xxxx" instead of "Open_xxxx" in code in a Worksheet? If that is what you mean then I think that may be the problem that I need to fix, because (as far as I can tell) the Public Subs are not found by the code which runs when the user clicks on an image in the Worksheet - in my OP I show the error message which the user sees after clicking on the buttons - and yet the Worksheet was created for the user by one of the buttons on the Ribbon which is created by the add-in itself! (*)

    Sure, Run can be used to call code of any workbooks, but VBA project should be rewritten for that.
    Yes, in that case it seems likely that there would be many other issues than just being able to call three or four Public Subs.

    (*)
    Please note that I am unfamiliar with Excel terms such as Worksheet, Workbook, Project, Add-in etc. I am still struggling to understand how they all relate to each other and I could easily be using the terms incorrectly when I try to explain what I am seeing. If you can point me to a document which starts at the beginning and which explains the structures of the objects, the relationships between them, their purposes, capabilities and limitations I should be most grateful.

  2. #12
    New Member
    Join Date
    Jul 2019
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Cannot run macro from add-in.

    Update on the situation:

    I added 'Module1' to Book1, then added a bunch of Subs like so:

    Sub A_B()

  3. #13
    New Member
    Join Date
    Jul 2019
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Cannot run macro from add-in.

    [I'll try again. I *think* I hit the 'TAB' key.
    After I completed an edit of my previous post, vBulletin said per the Administrator's rules I'm not allowed to do that.
    Admin: please feel free to delete my previous post and this entire aside.]

    Update on the situation:

    Today, with my friend, I added 'Module1' to Book1, and then we attempted to file his tax return.

    Numerous clicks on images were required.

    More often than not, the response to the click was a message saying that a Sub could not be found.

    Every time this happened I added to 'Module1' a Sub like this:

    Sub ABC()
    Run "AddIn.xlam!ABC"
    End Sub

    where ABC was obviously the name of the Sub that could not be found.

    Much to my surprise, after I had added about ten of these Subs, we had successfully filed my friend's tax return.

    Thanks once again one and all for your help with this issue.

    One last question:

    The tools available from the 'Developer' tab in Excel (at least from the point of view of a long-time Emacs user) leave a lot to be desired. It's a little bit like trying to view the pages of a ream of fan-fold paper through the slot in a letter box. What do people use when they're developing this stuff?

  4. #14
    Board Regular BlakeSkate's Avatar
    Join Date
    Jan 2015
    Posts
    293
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Cannot run macro from add-in.

    Quote Originally Posted by William_G View Post
    Numerous clicks on images were required.

    More often than not, the response to the click was a message saying that a Sub could not be found.
    are these images in the VBAproject excel objects?
    you can view the code on the images if they are there. It should show what its trying to do when you click an image

    Quote Originally Posted by William_G View Post
    Sub ABC()
    Run "AddIn.xlam!ABC"
    End Sub

    where ABC was obviously the name of the Sub that could not be found.
    if it works it works, but if the image has more code than just running one addin code then something somewhere is messed up
    its hard to tell without physically seeing it

    Quote Originally Posted by William_G View Post
    What do people use when they're developing this stuff?
    VBA stuff? We just type it i guess. I imagine some use other programs like notepad++ or visual studio to write their VBA, but the debug tool in the developer screen is actually quite useful so i just write code there. As far as things past VBA i'm unsure myself.
    -------------------------------------------------------------------------------
    I may not give the best VBA codes, but they sure are VBA codes.
    Help me help you by posting a snapshot of your data & your expected result
    Please use [ code][ /code] tags when posting VBA as well as proper indentation

  5. #15
    MrExcel MVP ZVI's Avatar
    Join Date
    Apr 2008
    Location
    Sevastopol
    Posts
    3,524
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    3 Thread(s)

    Default Re: Cannot run macro from add-in.

    Quote Originally Posted by William_G View Post
    ...Much to my surprise, after I had added about ten of these Subs, we had successfully filed my friend's tax return.

    Thanks once again one and all for your help with this issue.

    One last question:

    The tools available from the 'Developer' tab in Excel (at least from the point of view of a long-time Emacs user) leave a lot to be desired. It's a little bit like trying to view the pages of a ream of fan-fold paper through the slot in a letter box. What do people use when they're developing this stuff?
    Good job! Nice to know you have made it out!

    Your method is better than copying code from the AddIn into module of Book1 - code is stored in one place without doubling.

    Macro is assigned to an image by right clicking on that image and choosing the “Assign Macro...”

    Major controls in Developer tab of a Ribbon are went from an old Visual Basic command bar of Excel 2003, according to the principle of least surprise
    Last edited by ZVI; Jul 24th, 2019 at 11:12 PM.
    Vladimir Zakharov

  6. #16
    New Member
    Join Date
    Jul 2019
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Cannot run macro from add-in.

    Quote Originally Posted by BlakeSkate View Post
    are these images in the VBAproject excel objects?
    you can view the code on the images if they are there. It should show what its trying to do when you click an image
    I believe that the images are Excel Objects but I don't know how to be sure. I don't really know what defines an Excel Object.

    The outline of the structure, at least as much of it as I can describe, is as follows:

    After the AddIn is installed into Excel, in the row of Tabs which includes the 'Developer' Tab, the AddIn creates a new Tab immediately to the left of the 'Developer' Tab.
    When you click the new Tab, a Ribbon appears immediately below this row of Tabs.
    There are several Buttons on this Ribbon, and the instructions (*) tell you to work along the Buttons on the Ribbon from left to right in sequence.
    The first three Buttons pop up boxes into which various personal details need to be entered; along the way the Addin requests a 'token' from the Tax Authority.
    So far this all works OK. I do not know if the boxes seen so far are themselves spreadsheets, but I think not.
    The fourth Button opens what I'm sure is a spreadsheet -- you can see a rectangular cursor with a heavy black outline if you click on random blank parts of it.
    This spreadsheet contains areas for numbers which need to be filled in and a number of Buttons.
    AFAICT none of these Buttons works, when you click them all you get is error messages.
    A 'Book1' is mentioned in the error messages (e.g. "Cannot find Book1!ABC").
    These non-working Buttons are those which I've made work by adding Subs in my new Module.
    I created 'Module1' using the 'Visual Basic' Button on the 'Developer' Tab, which opens a window showing the AddIn and this 'Book1'.
    I guess 'Book1' was created by the Addin.
    I added a Module to 'Book1', Excel decided to call it 'Module1'.
    I've tried obvious things like right-clicking on the Buttons to see their Properties but nothing happens when I do that.
    For use by someone who isn't expected to do anything other than use the Buttons to enter data it would make sense to disable viewing (and altering!) of the Button Properties.
    As I said this is my first experience of Excel. I wonder if there's something I don't know about configuring Buttons which would let me see their Properties.

    (*)There is a separate PDF document with step-by-step instructions. They are fairly thorough, although the authorship is a little bit variable.


    if it works it works, but if the image has more code than just running one addin code then something somewhere is messed up
    its hard to tell without physically seeing it
    As you might expect my friend has made an agreement with the supplier not to give the code to anyone else so I'm afraid I can't give it to you.

    For sure something is messed up - I'd really hoped to find out what that is, but I haven't. If this isn't, say, a legacy issue which only appears in older versions of Excel then I can't see how anyone could ever have successfully used this Addin. My friend's a big bloke with a short temper so I don't want to suggest that he spends money upgrading Excel just to pander to the Tax Man.

    I now expect (and fervently hope) not to see Excel again until the next time my friend has to do another tax return...

  7. #17
    Board Regular BlakeSkate's Avatar
    Join Date
    Jan 2015
    Posts
    293
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Cannot run macro from add-in.

    Quote Originally Posted by William_G View Post
    I believe that the images are Excel Objects but I don't know how to be sure. I don't really know what defines an Excel Object.
    When you press alt + f11 that will bring up the VBA screen. there should be a tab in the project viewer that says "VBA Project (@@@@@)" where @ = your workbook or addin
    when you expand the selection there is "microsoft excel objects". you may be able to find the image codes that are broken here? i understand that you cant post the code as its paid for and contractual to your friend. I'm just saying anything i say is a stab in the dark because i CAN'T see it.

    Quote Originally Posted by William_G View Post
    As you might expect my friend has made an agreement with the supplier not to give the code to anyone else so I'm afraid I can't give it to you.
    Plan B needs to be that the supplier fix the excel file for you / handle your issue since you paid.
    -------------------------------------------------------------------------------
    I may not give the best VBA codes, but they sure are VBA codes.
    Help me help you by posting a snapshot of your data & your expected result
    Please use [ code][ /code] tags when posting VBA as well as proper indentation

  8. #18
    New Member
    Join Date
    Jul 2019
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Cannot run macro from add-in.

    Interesting that I'm now getting spam to the domain that I used to register here...

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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