+ Reply to Thread
Results 1 to 12 of 12

Can't open my workbook with the vba code window opening

  1. #1
    Registered User
    Join Date
    08-12-2012
    Location
    Gastonia, NC
    MS-Off Ver
    Excel 2010
    Posts
    8

    Can't open my workbook with the vba code window opening

    Good Afternoon to all:
    I have a 2010 workbook with code with all sheets protected AND the code protected. This workbook will be distributed to a number of people who are not familiar at all with VBA. My problem is that this workbook opens on the VBA window every time it is opened. Every time. I want the workbook to open on the sheet that was active at the last saving/closing and not on the code window. I don't want the code window to open at all. How do I do this or how can I fix the problem? Thanks for your time. Bob

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Can't open my workbook with the vba code window opening

    Hi Bob & Welcome to the Forum,

    In the code on the open event, why not add

    Please Login or Register  to view this content.
    this way the sheet you want is always the sheet opened.

    And also maybe password protect the VBAProject.

    Alt +F11 >> Visual Basic Editor >> Tools >> VBAProject Properties >> Protection tab
    Check Lock Project for Viewing and enter a password twice
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    08-12-2012
    Location
    Gastonia, NC
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Can't open my workbook with the vba code window opening

    Jeff Thank you for your prompt reply. One thing that I forgot to say was both sheets open at the same time. I have two monitors and the active worksheet opens on one monitor and the vba code sheet opens on the other. When I sent this out to my son's (He's the one I'm helping) cohorts they open the file and the vba code window opens on top of the worksheet.
    Since they like to play around I don't want the vba code window to open at all and was hoping that I was doing something wrong and it would be a simple fix to have it not show up.
    My second choice was to get some code to keep it from opening at all or possibly upon the workbook opening, have some vba code to automatically close it.
    I did enable the VBAProject Properties and have it password protected, but I'd rather not give them the temptation. Bob

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Can't open my workbook with the vba code window opening

    Honestly I have never experienced the code window and the excel sheet both opening at the same time.

    I also have two monitors and every time I open Excel I have to select Alt + F11 to open the VBE.

    Even if the VBE did not open (which you said is protected already), what would stop them from selecting Alt + F11 and opening it?

    I can ask the real Excel Guru's for some further assistance if necessary.

  5. #5
    Registered User
    Join Date
    08-12-2012
    Location
    Gastonia, NC
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Can't open my workbook with the vba code window opening

    Quote Originally Posted by jeffreybrown View Post
    Honestly I have never experienced the code window and the excel sheet both opening at the same time.

    I also have two monitors and every time I open Excel I have to select Alt + F11 to open the VBE.
    On any other worksheet that I have this is true, but not on this one and there is no code that we can find where we call this window up.

    Even if the VBE did not open (which you said is protected already), what would stop them from selecting Alt + F11 and opening it?
    I don't want to waive a piece of candy in front of them, and if they use the Alt + F11 they still require a password.

    I can ask the real Excel Guru's for some further assistance if necessary.
    If you would I would appreciate it.
    I have this as a 2003 worksheet and it's saved in .xls format. It opens the same in a 2003 or 2010 excel program and that's why I thinks it's something
    peculiar with this workbook (I have about 5 sheets in it) but am at a loss to figure out what.
    Thanks
    Bob Reynolds

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Can't open my workbook with the vba code window opening

    Hi Bob

    Attach the workbook...perhaps we can figure it out.

    To Attach a File:

    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  7. #7
    Registered User
    Join Date
    08-12-2012
    Location
    Gastonia, NC
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Can't open my workbook with the vba code window opening

    Gladly, It has been cleaned and no data exists in it, but the problem still exists. Thank you in advance for the help.
    Bob Reynolds
    Attached Files Attached Files

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Can't open my workbook with the vba code window opening

    Hi Bob,

    The VBAProject is password protected.

  9. #9
    Registered User
    Join Date
    08-12-2012
    Location
    Gastonia, NC
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Can't open my workbook with the vba code window opening

    AS an explanation. This workbook is set up to import numerous worksheets that others complete. It selects data and pastes it into the various cells and then does a sort and count on the Utility Sheet. It takes data from the Historical Data sheet and puts it into the fat-crit-hr sheet and labels it ytd last ytd last month and last month last year, giving a complete report of the stats. If you don't mind please email me privately to get the password which is the same for all sheets. Thanks again

  10. #10
    Registered User
    Join Date
    08-12-2012
    Location
    Gastonia, NC
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Can't open my workbook with the vba code window opening

    rjr1040 is what you're looking for all pages

  11. #11
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Can't open my workbook with the vba code window opening

    Hi Bob,

    I don't have all that much experience with using SendKeys and from what I've seen most users seem to stray from them, but again, not much experience.

    Something in the ThisWorkbook Workbook_Open is causing the problem. I remed out all the Workbook_Open code and it opens fines.

    If you can explain what you are doing with all of those SendKeys then maybe that can sort it out.

  12. #12
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Can't open my workbook with the vba code window opening

    Hi Bob

    This line of code in Workbook_Open is opening VBA
    Please Login or Register  to view this content.
    ...rem it out and the issue appears to go away.

+ 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