+ Reply to Thread
Results 1 to 5 of 5

Error after converting standard workbook to add in

  1. #1
    Registered User
    Join Date
    07-14-2014
    Location
    Glasgow,UK
    MS-Off Ver
    2010
    Posts
    2

    Error after converting standard workbook to add in

    Hi
    I have recently converted a standard workbook (.xlsm) to an addIn(.xlam) file and it now fails when attempting call and activate one of the associated worksheets with the errors below. It appears as if the worksheets are now out of scope.

    Run-time error '1004':
    Method 'Sheets' of object '_Global' failed


    The code I am using is
    ------------------------------------------------------------
    Private Sub Command_Next1_Click()
    Worksheets("Sheet1").Activate
    End Sub
    -------------------------------------------------------------

    I have tried changing the sheet reference format to those below but still get the same error.
    Sheets(1).Activate
    Worksheets("lookups").Activate

    Any advice on this issue would be very much appreciated.
    Regards
    Iain

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Error after converting standard workbook to add in

    Which workbook are you trying to activate the worksheet in?

    Have you tried specifying that in the code?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    07-14-2014
    Location
    Glasgow,UK
    MS-Off Ver
    2010
    Posts
    2

    Re: Error after converting standard workbook to add in

    Hi Norie

    Thanks for the quick response.

    The original wokbook is called ExpensesWB.xlsm and converted ExpensesWB.xlam both use the default “ThisWorkbook” workbook. When I prefix with this I get the error.
    “Method or data member not found”

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Error after converting standard workbook to add in

    You can't activate a sheet in an add-in since they are all hidden. I can only guess that either you need to use Activeworkbook, or you need to avoid trying to activate the sheet. Hard to say without more information.
    Remember what the dormouse said
    Feed your head

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Error after converting standard workbook to add in

    Ian

    ThisWorkbook is the code the workbook is in, ie the add-in,, it can't be used to refer to another workbook.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 4
    Last Post: 05-10-2014, 10:45 AM
  2. [SOLVED] Converting Standard Time format (hh:mm:ss) to number of minutes
    By xygrax in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-27-2014, 10:54 AM
  3. Converting all date formats to one single standard format.
    By booo in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-25-2010, 07:14 PM
  4. Converting columns of non-standard formatted data into a table (rows)
    By Peter33 in forum Access Tables & Databases
    Replies: 2
    Last Post: 10-02-2009, 04:36 PM
  5. Converting name to standard time
    By sridharKj in forum Excel General
    Replies: 1
    Last Post: 03-21-2005, 12:38 PM

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