+ Reply to Thread
Results 1 to 22 of 22

Error 91 - Object variable or with block variable not set

  1. #1
    Registered User
    Join Date
    12-06-2007
    Posts
    8

    Error 91 - Object variable or with block variable not set

    I have tried to execute Auto_Open to run the macro at Start of excel
    This works fine when we just put code
    Please Login or Register  to view this content.
    But When I put our actual code to manipulate the data of excelsheet as follows

    Please Login or Register  to view this content.

    We get the following error
    Error 91 - Object variable or with block variable not set
    Last edited by VBA Noob; 12-06-2007 at 08:35 AM.

  2. #2
    Forum Contributor colofnature's Avatar
    Join Date
    05-11-2006
    Location
    -
    MS-Off Ver
    -
    Posts
    301
    I think - and if I'm wrong I'm sure someone will correct me - that when the Auto_Open code is called, the workbook hasn't yet been instansiated. That is: when your code is being run, the workbook exists, but it's properties have yet to be defined. It's like you've asked for an ice cream, but haven't said if you want a topping: You:"Double choc-chip!"; Ice-cream god:"OK", You:"Rapsberry" Ice-cream god:"Raspberry what?" See?
    If you give someone a program, you will frustrate them for a day; if you teach them how to program, you will frustrate them for a lifetime.

  3. #3
    Forum Contributor colofnature's Avatar
    Join Date
    05-11-2006
    Location
    -
    MS-Off Ver
    -
    Posts
    301
    Sorry, talk about mixing metafors! Even I couldn't take any meaning from that...

  4. #4
    Registered User
    Join Date
    12-06-2007
    Posts
    8

    Very Urgent .Please Help

    Hi,

    That only i want to ask, Auto_open gets invoked when excel file is loaded.
    Is there something like this sub_procedure which is invoked after loading any file
    Or every time When I open the excel file , I want same formatting to be applied.So I have called the micro in auto_open
    this micro actualy deals with Activesheet which doesnt present when file is loaded.
    Please help me out .As its very urgent

  5. #5
    Registered User
    Join Date
    12-06-2007
    Posts
    8

    Very Urgent........Executing module at stratup

    Hi,
    I want to remove the images in excel file, autofit the contents for that purpose i have written the code as follows .But this code should execute.
    whenever i open the files .I tried calling this in Auto_Open.
    But i got the error that Object varible.not set.Please help me out with this regards as its very urgent

    Please Login or Register  to view this content.
    Last edited by Paul; 12-07-2007 at 02:13 AM.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Please wrap your code with code tags. If you don't know how, consult the forum rules.

    Thanks.

  7. #7
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    Jaiswati, I wrapped your code as required - future posts may be deleted. Please click the link in my signature to review the forum rules prior to posting.

    (Of course, I just saw shg's response..oh well)

  8. #8
    Registered User
    Join Date
    12-06-2007
    Posts
    8

    Very Urgent .Please Help

    Hi,

    I Have Added code in code tag.HereAfter i wil do the same

  9. #9
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    Instead of using Auto_Open, you can use the ThisWorkbook_Open event, in which you could activate a specific sheet and then use the ActiveSheet.xxxx format.

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    I Have Added code in code tag.HereAfter i wil do the same
    Thank you.

    Your code doesn't compile, and has undefined variables like the I1 in
    Please Login or Register  to view this content.
    I'd start there.

    I can't follow the intended logic of the DeleteColumn module.

  11. #11
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    jaiswati

    Please read the forum rules

    When you signed up to this site you agreed not to post the same question to multiple forums

    Your duplicate threads have been Closed.

    A thread with the rules is available at the top of each forum


    Thread http://www.excelforum.com/showthread.php?p=1860679 opened after receiving PM from jaiswati
    Last edited by mudraker; 12-07-2007 at 02:48 AM.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  12. #12
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    jaiswati

    Please read the forum rules

    When you signed up to this site you agreed not to post the same question to multiple forums

    Your duplicate threads have been Closed.

    A thread with the rules is available at the top of each forum

  13. #13
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Thread re-opened after receiving PM from jaiswati

  14. #14
    Registered User
    Join Date
    12-06-2007
    Posts
    8

    ThisWorkbook_Open

    I Changed the sub proc from Auto_open to ThisWorkbook_Open() , still i got the same error that object variable or block variable not set.
    Please help me asap....Its very urgent

    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    12-06-2007
    Posts
    8

    Hi mudraker and Paul

    Please tell me to get out of this situation in exact way (with help of code and as in provided in this post).

    Waiting for the reply.

    Thanks and Regards
    Swati

  16. #16
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    Thread Closed Again.
    For the same reason.
    Repeatedly posting the same question in different threads is an ineffective way to get an answer.
    And against the rules
    Last edited by mikerickson; 12-07-2007 at 03:08 AM.

  17. #17
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    THREAD CLOSED.
    This is the same question in yet another thread.

  18. #18
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Swati,

    I have merged these three threads into one and reopened.

    I urge you in the strongest way to not keep opening new threads with the same question. If your posting rights are revoked, you will lose access to a valuable asset. And if they aren't revoked, people will come to ignore your questions.

  19. #19
    Registered User
    Join Date
    12-06-2007
    Posts
    8

    Hi shg

    Hi shg,

    Surely.I was in panic Now its ok. I wil take care from next time

    Swati

  20. #20
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Thank you. Please become a poster boy for forum etiquette. I have people annoyed with me for reopening this thread; vindicate my decision.

  21. #21
    Registered User
    Join Date
    10-10-2012
    Location
    montevideo, uruguay
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Error 91 - Object variable or with block variable not set

    I think that perhaps this people dont know about vba because dont response your question, dont you think? they only care about the forum rules

  22. #22
    Registered User
    Join Date
    10-10-2012
    Location
    montevideo, uruguay
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Error 91 - Object variable or with block variable not set

    This forum its sucks!!

+ 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