+ Reply to Thread
Results 1 to 5 of 5

Runtime error 1004 while loading Add-In

  1. #1
    Registered User
    Join Date
    07-04-2009
    Location
    San Diego
    MS-Off Ver
    CA
    Posts
    4

    Runtime error 1004 while loading Add-In

    Hello:

    I have a workopen event as follows:
    Please Login or Register  to view this content.
    The workbook is saved as an xlam file.

    If I open this file after Excel 2007 loads with file open menu
    everything is fine. The code runs without error and
    the helpcontext etc work just fine.

    Now if I load the file as an add-in through the add-in
    manger using the Excel Option menu it again works just fine.

    But if I close Excel and then Open Excel (so that add-in
    loads automatically) I get an error message that says:
    Run-time error '1004'
    Cannot edit a macro on a hidden workbook. Unhide
    the working using the Unhide command.
    Can someone help so that the code works when
    add-in is loaded automatically?

    Thanks.
    Last edited by PVBERG; 07-07-2009 at 01:01 PM. Reason: Added Code and Quote Tags

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: Runtime error 1004 while loading Add-In

    How about placing the code in a routine within a standard code module and calling that using the OnTime method

    Thisworkbook object
    Please Login or Register  to view this content.
    Standard code module
    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    07-04-2009
    Location
    San Diego
    MS-Off Ver
    CA
    Posts
    4

    Re: Runtime error 1004 while loading Add-In

    Hello Andy:

    Thank you so much for your suggestion. It solved the problem.

    If you are willing could you explain what the difference is between
    the method you suggested and a plain call to the routine such as
    Call AssignedHelp? (I first did it this way and it did not work. I posted
    the code I did because it was more direct.) Particularly since
    the time you added to "now" is apparently zero. I guess
    I would be less confused if you had suggested that I add
    a small amount of time to delay the call.

    Again thanks for your help

    Pieter

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: Runtime error 1004 while loading Add-In

    apparently the small delay in processing the command via the ONTIME rather than a direct Call allows excel to untwist it's knickers.

  5. #5
    Registered User
    Join Date
    07-04-2009
    Location
    San Diego
    MS-Off Ver
    CA
    Posts
    4

    Re: Runtime error 1004 while loading Add-In

    Hello:

    Thanks again for the information. I have played with it a little more and I think you are right. I have tried loading Excel a number of times and there were a few times that I still got the error, so it may just depend on what else is going on. So to make sure I have added a slight amount of time to the NOW to insure that even if it processes very quickly there will be a sufficient delay. I have not had a failure since.


    Pieter

+ 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