+ Reply to Thread
Results 1 to 7 of 7

run a macro when a file opens

  1. #1
    Forum Contributor
    Join Date
    08-03-2005
    Posts
    272

    run a macro when a file opens

    Is it possible to set up a macro when a file is opened it automatically does the following steps:

    Select “instructions” sheet
    Hide rows 1-5
    Set password to ou
    Select “Orders” sheet

    All without showing that it did this?

    I want to use this as a safety in case we forget to do it when we close the file. So if it already in place doing it again will not hurt anything.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    Code goes in ThisWorkbook module

    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Contributor
    Join Date
    08-03-2005
    Posts
    272
    Quote Originally Posted by VBA Noob
    Maybe

    Code goes in ThisWorkbook module

    Please Login or Register  to view this content.
    VBA Noob
    Thanks VBA, you rock as always...

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Your welcome

    VBA Noob

  5. #5
    Forum Contributor
    Join Date
    08-03-2005
    Posts
    272
    Ok, but one problem though, if it is already hidden then it give me a debug error. How do you override this?

  6. #6
    Forum Contributor
    Join Date
    08-03-2005
    Posts
    272
    Ok, I figured it out the error is caused because it is trying to hide on a protected sheet. I put unprotect before it hides and it works weather it is protected or not.

  7. #7
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Could use

    Please Login or Register  to view this content.
    or try

    Please Login or Register  to view this content.
    VBA Noob
    Last edited by VBA Noob; 01-02-2008 at 03:57 PM.

+ 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