+ Reply to Thread
Results 1 to 3 of 3

Automate VBA GUI when workbook opens

  1. #1
    Registered User
    Join Date
    04-29-2011
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    2

    Automate VBA GUI when workbook opens

    Hey All, First I apologize because I don't know a lot about VBA. I have lots of experience with Excel, but this is the first time I've tried to write a VBA program. After a couple days of searching I've concluded that the situation is such that: 1) my question is so basic everyone assumes no one is as idiotic as I am and has never had this issue *OR* 2) I've done something wrong.

    The VBA is a little GUI that prompts a user to enter a zip code, then it searches a spreadsheet that contains the zip codes and returns to the user the carrier code of our preferred shipper for that zip code. This part seems to be working as intended.

    The part that I'm having trouble getting to work is making the VBA activate automatically when the .xlsm is opened.

    Here is a copy of the code:
    Please Login or Register  to view this content.
    Thanks for any assistance, direction, or help.

    Kind Regards,
    ~daniel
    Last edited by ~daniel; 04-29-2011 at 03:35 PM. Reason: To try to make title more compliant with forum policies - SOLVED

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Automate VBA GUI when workbook opens

    Hi daniel and welcome to the forum,

    It sounds like you need to have an EVENT that calls your macro. If you want the macro to perform when you open a workbook you need to put some code behind the
    ThisWorkbook that would start with
    Please Login or Register  to view this content.
    Look at this page for examples http://www.contextures.com/xlfaqMac.html#Mac04

    BTW - Yesterday I couldn't get a sub to fire and it was because I started with the word Private instead of Public. There is a lot to know.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    04-29-2011
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    2

    Talking Re: Automate VBA GUI when workbook opens

    Thanks Marvin,

    That definitely led me in the right direction. Here's what I ended up with:

    Please Login or Register  to view this content.
    Originally I was trying to use the Activate function at the Form level, so when the Open function worked at the ThisWorkbook level, it was doing some funky stuff.

    I really appreciate the help! Hope you have a great weekend.

    Kind Regards,
    ~daniel

+ 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