+ Reply to Thread
Results 1 to 20 of 20

Run-time error 91

  1. #1
    Registered User
    Join Date
    04-24-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    14

    Run-time error 91

    Hello all,

    I am trying to run the below macro, but getting Run-time Error 91 : Object variable or With block variable not set
    Can you please help. It directs error at line SheetNames = EmailInfo.Columns(1).Cells.Value

    Please Login or Register  to view this content.

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Run-time error 91

    Should be
    Please Login or Register  to view this content.
    Instead of
    Please Login or Register  to view this content.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Registered User
    Join Date
    04-24-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    14

    Re: Run-time error 91

    Hi gmr4evr1,

    Thanks for the reply, i still get the same error message with this code
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    04-24-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    14

    Re: Run-time error 91

    Can anyone please help on this.

  5. #5
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,902

    Re: Run-time error 91

    Please Login or Register  to view this content.
    After above line stick in following and see what comes up in immediate window.

    Please Login or Register  to view this content.
    If it only returns single cell address, your workbook structure needs to be changed or referenced cell changed in code.
    Upload sample workbook which produces the error you mentioned.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  6. #6
    Registered User
    Join Date
    04-24-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    14

    Re: Run-time error 91

    Hi CK76,

    Thanks for the reply. The macro works I keep the "C:\Data\Source.xls" open and run it. Not sure why.

    Another error I am getting now is run-time error '-2147221080 (800401a8) it stops at the below code

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-24-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    14

    Re: Run-time error 91

    Can anyone help me to solve please.

  8. #8
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,902

    Re: Run-time error 91

    I'd suggest uploading sample file. Or at least let us know what value variables hold at the time of the error. Hard to trouble shoot without it.

  9. #9
    Registered User
    Join Date
    04-24-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    14

    Re: Run-time error 91

    Hi CK76,

    I could fix these problems. Now I require to modify the range reference in this macro. The macro currently picks up all the sheets names in ColumnA and then the corresponding emails address columns B onwards. How do i modify it to pick the sheets names anything down D2 and then corresponding emails address from Columns E onwards.

  10. #10
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,902

    Re: Run-time error 91

    Change...
    Please Login or Register  to view this content.
    To...
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    04-24-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    14

    Re: Run-time error 91

    thanks for the reply , when I change this, I get the error message 'run-time error '9': Subscript out of range

    and stops at the below line

    Please Login or Register  to view this content.

  12. #12
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,902

    Re: Run-time error 91

    I'll need to see sample workbook(s) where it produces error. As I've written previously, it's difficult to debug your code without seeing how your data set has been set up in each workbook.

  13. #13
    Registered User
    Join Date
    04-24-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    14

    Re: Run-time error 91

    Attached is the sample file
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    04-24-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    14

    Re: Run-time error 91

    hi CK76 , did you get chance to look into it?

  15. #15
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,902

    Re: Run-time error 91

    You hadn't implemented my modification. Also, you had 1st row empty. The code did not account for that. Try below.
    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    04-24-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    14

    Re: Run-time error 91

    Thanks for the reply. Now I get runtime error 438 : Object doesn't support this property or method and stops at the below line

    Please Login or Register  to view this content.

  17. #17
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,902

    Re: Run-time error 91

    Oh, just change to.

    Please Login or Register  to view this content.

  18. #18
    Registered User
    Join Date
    04-24-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    14

    Re: Run-time error 91

    Thanks for the help CK. It works fine. Just that I had to modify the j reference to 4 instead of 1 as it was taking sheet names as email addresses

    Please Login or Register  to view this content.
    Once the macro completes, the "Source" file automatically closes. Not sure why.

  19. #19
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,902

    Re: Run-time error 91

    ? I assumed this line was intended?
    Please Login or Register  to view this content.
    If you don't want to close file. Remove the line.

  20. #20
    Registered User
    Join Date
    04-24-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    14

    Re: Run-time error 91

    yep, got it. Thanks for fixing these.

+ 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

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