+ Reply to Thread
Results 1 to 11 of 11

Workbook_open event

  1. #1
    Registered User
    Join Date
    04-02-2020
    Location
    Bratislava
    MS-Off Ver
    2016
    Posts
    80

    Workbook_open event

    Hi,

    I am trying to set up a workbook_open event which will be only running the first time you open the file. In this way, if the macro found a sheet called "LogDetails" the macro will not be executed, else, will create the "LogDetails" sheet.

    Please Login or Register  to view this content.
    BUT IT IS NOT WORKING AND THAT IS WHY I ASK FOR HELP PLEASE

    THANKS A LOT

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Workbook_open event

    Hi, something like this:

    Please Login or Register  to view this content.
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Registered User
    Join Date
    04-02-2020
    Location
    Bratislava
    MS-Off Ver
    2016
    Posts
    80

    Re: Workbook_open event

    Looks good but it returns me "End If without block if"

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Workbook_open event

    You forgot your programming skills,?

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Workbook_open event

    I've checked but, as far as I can see now, there is NO error here. Don't have Excel at hand now, but you can check

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Workbook_open event

    How about
    Please Login or Register  to view this content.

  7. #7
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Workbook_open event

    Hi, you beat me to it. minor suggestions changes;
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    04-02-2020
    Location
    Bratislava
    MS-Off Ver
    2016
    Posts
    80

    Re: Workbook_open event

    Thanks that worked! Now how can I set up a password to enable the view of LogDetails? The thing is that I cannot protect the sheet "LogDetails" with the conventional method because it is registering data from the main sheet (Tracking changes) and if I protect it the macro won't run.

    I tried with the following, but it seem it is not right:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Workbook_open event

    You need to protect that worksheet every time the workbook opens with the parameter USerinterfaceOnly:=True, in this manner a macro can always make changes without needing to unprotect it.
    Try this code:
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    04-02-2020
    Location
    Bratislava
    MS-Off Ver
    2016
    Posts
    80

    Re: Workbook_open event

    Thank you! Did not know about that property.. As always very helpful

    Regards,

  11. #11
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Workbook_open event

    I think I mentioned it in one of your previous posts, but you can read about if you Google the term

+ 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. Workbook_Open event do not working?
    By Dumy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-11-2013, 04:09 AM
  2. Workbook_Open Event
    By inwalkedbud in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2007, 09:38 AM
  3. Workbook_Open Event
    By Josh_123456 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-09-2007, 08:58 AM
  4. Workbook_Open Event
    By The_Vulcan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-24-2006, 10:12 PM
  5. workbook_Open event Procedure
    By peerless in forum Excel General
    Replies: 1
    Last Post: 05-22-2006, 05:21 PM
  6. [SOLVED] workbook_Open event Procedure
    By peerless in forum Excel General
    Replies: 0
    Last Post: 05-22-2006, 05:20 PM
  7. Workbook_Open() Event
    By Bill Martin in forum Excel General
    Replies: 9
    Last Post: 01-13-2006, 04:30 PM
  8. Workbook_Open event not firing
    By 0013 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-24-2005, 05:06 PM

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