+ Reply to Thread
Results 1 to 11 of 11

Run-time error 91

  1. #1
    Registered User
    Join Date
    01-08-2020
    Location
    amsterdam
    MS-Off Ver
    2010
    Posts
    45

    Run-time error 91

    I have a question. At my workplace, I have an Excel file containing a list of Excel files and their corresponding tab sheet numeric names. With another macro, I check the excel planning file to verify if the numbers on the planning sheet match the overview list.

    On workstation 1, the macro for checking the planning works correctly.
    On workstation 2, the macro for checking the planning works correctly.
    On workstation 3, I encounter a "Run-time error 91" related to a tab sheet name in the planning file.

    The Excel version is the same on all workstations.
    The files we are working with are exactly the same.
    The settings for both Excel versions are identical.

    My specific question is, what could be the cause of receiving this "Run-time error 91" on workstation 3? Does anyone have any ideas?

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Run-time error 91

    There are a few possible reasons why you might be receiving a "Run-time error 91" on workstation 3, even though the Excel version and settings are the same on all workstations:
    • The tab sheet name in the planning file on workstation 3 may contain special characters that are not supported by the macro. For example, the tab sheet name may contain a space, a hyphen, or an underscore. You can try removing any special characters from the tab sheet name and see if that resolves the error.
    • The tab sheet name in the planning file on workstation 3 may be too long. The maximum length for a tab sheet name is 31 characters. If the tab sheet name is longer than 31 characters, you can try shortening it and see if that resolves the error.
    • The tab sheet name in the planning file on workstation 3 may be the same as the name of a worksheet function. For example, the tab sheet name may be the same as the name of the SUM function or the AVERAGE function. You can try changing the tab sheet name to something unique and see if that resolves the error.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: Run-time error 91

    Please see: https://learn.microsoft.com/en-us/of...t-set-error-91
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    01-08-2020
    Location
    amsterdam
    MS-Off Ver
    2010
    Posts
    45

    Re: Run-time error 91

    Thank you very much for your message. I did indeed check these steps. Unfortunately, they didn't yield any results. The macro is located in a file that can be opened on all three workstations. The planning file is identical on all three workstations. That's why I'm having trouble understanding the issue. If it were a code error, I would expect to receive an error message on all three workstations. If it were an issue with the planning file, I would also expect to receive the error message on all three workstations. Am I reasoning this incorrectly? Could it possibly be a settings-related issue?

  5. #5
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Run-time error 91

    I have no idea if this is the problem but since I found this I thought I should share it.

    Short quote from the page:
    "The DCOMCnfg.exe file, which is frequently used to establish rights and set system-wide security settings, is usually the problem."

    I have a Run Time Error 91 for an Excel Add In
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Run-time error 91

    Are you sure it's 91 not 9? If so, please at least post the line of code.
    Rory

  7. #7
    Registered User
    Join Date
    01-08-2020
    Location
    amsterdam
    MS-Off Ver
    2010
    Posts
    45

    Re: Run-time error 91

    I'm confident that it's a 91 error message. The error message '91' is occurring on this line: Set ws = wb.Sheets("Line 1").

  8. #8
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: Run-time error 91

    If the wb (assuming it's a workbook) variable is not set you will get a 91 error message.

    Check via these lines immediately above the line you posted in thread 7:

    Please Login or Register  to view this content.
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  9. #9
    Registered User
    Join Date
    01-08-2020
    Location
    amsterdam
    MS-Off Ver
    2010
    Posts
    45

    Re: Run-time error 91

    Certainly! Here's a friendly message in English:

    Indeed, I'm getting the message "wb" variable has not been set while I have defined "wb" as Workbook. Because a new Excel file needs to be checked every week, I'm using the Application.FileDialog(msoFileDialogFilePicker) to select the new file. Could this be the cause? This is my code:

    Please Login or Register  to view this content.

  10. #10
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Run-time error 91

    You need to put that test after the line that opens the workbook:

    Please Login or Register  to view this content.

  11. #11
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: Run-time error 91

    As you're using Application.FileDialog(msoFileDialogFilePicker) to select the workbook I can't see why the wb variable would not be getting set

+ 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. [SOLVED] Error message: Run-Time error '1004 '; application-defined or object-defined error
    By Davasu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2015, 06:52 AM
  2. Replies: 1
    Last Post: 10-22-2015, 05:50 AM
  3. VBA ERROR: run time error 1004: Application-defined or Object-defined error in excel 2013
    By AnanthKrishna in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-13-2015, 06:16 AM
  4. Cannot Publish Excel Pivot Chart - Run Time Error
    By crisb184 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-11-2013, 07:04 AM
  5. [SOLVED] Error " Run-time error '1004': application defined or object defined error
    By lengwer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-11-2013, 07:26 AM
  6. run-time error ;2147023179 (800706b5) time automation error interface unknown
    By karthik72 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-02-2012, 09:31 AM
  7. Error "run-time Error '1004': General Odbc Error
    By D4WNO77 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-16-2012, 09:55 AM

Tags for this Thread

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