Why don't I have ThisWorkbook in my VBA editor, and how do I activate it?

Emo Emilianov 0 Reputation points
2025-09-02T05:20:05.9066667+00:00

Why don't I have ThisWorkbook in my VBA editor, and how do I activate it?

Microsoft 365 and Office | Office Online Server
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Michelle-N 10,010 Reputation points Microsoft External Staff Moderator
    2025-09-02T07:12:07.3933333+00:00

    Hi @Emo Emilianov

    Thank you for posting question to Microsoft Q&A.

    Based on your description, it sounds like you're referring to the ThisWorkbook object. May I ask which application you are trying to find ThisWorkbook in? If it's for Excel, then this is what the VBA editor looks like in my environment, with the Project Explorer window visible on the left. Is this the result you want to achieve?User's image To better understand the situation, could you please provide some more information?

    -What is the file format of the workbook you are using (e.g., .xlsx, .xlsm, .xlsb)? You need to use a macro-enabled format like .xlsm.

    -Can you describe any errors you are encountering in your environment? Providing specific details or a screenshot of any error messages would be very helpful.

    If the issue is simply that this window is not visible, you can easily activate it. Please follow these steps:

    +In Excel, press Alt + F11 to open the VBA Editor > If you do not see the project window on the left (as shown in the screenshot), press Ctrl + R. This keyboard shortcut will show the Project Explorer window. Inside this window, you will find your VBAProject, which contains the ThisWorkbook object along with all the sheets and modules for your file.

    It's also possible that you accidentally hid the Project Explorer by dragging it. If so, move your mouse cursor to the area I'm pointing to, and then click and drag to pull it back out.User's image

    I hope you are able to resolve this issue quickly.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".   

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

  2. Stefan Blom 325K Reputation points MVP Volunteer Moderator
    2025-09-02T08:14:05.2266667+00:00

    At least one workbook must be open for ThisWorkbook to show up in the Project Explorer. Double-click ThisWorkbook to open it and display a list of events that you can use.

    User's image

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.