Forum Discussion

pauljacobs's avatar
pauljacobs
Copper Contributor
Jan 31, 2024

Visual Basic No Longer Visible

I wanted to do two things with Visual Basic:  1) have the workbook open at a specific tab every time and 2) have a message pop up when the workbook opens.

 

I went to Options>Customize Ribbon and added Developer.

 

Then I went to the Developer tab and clicked on Visual Basic.  Here's what I saw:

 

From there I followed instructions on how to add a message.  I then saved the workbook as .xlsm, closed it and then opened it again to see if the message appeared.

 

I made the mistake of copying and pasting the instructions from an example in this forum.  I say "mistake" because when it didn't work I searched the forum and found that the double quotes may have been a different type than what Visual Basic was expecting.  

 

Then I opened Visual Basic again to change the message and this is what I saw:

How do I get back to the original appearance?  

 

I'm using Windows 10 through Microsoft 365.  All updates have been installed.

 

Thanks.

 

 

3 Replies

  • pauljacobs 

    In the Visual Basic Editor, select View > Project Explorer and View > Properties Window.

     

    VBA expects "straight" quotes ", not "curly/smart" quotes “ and ”.

    • pauljacobs's avatar
      pauljacobs
      Copper Contributor

      HansVogelaar 

       

      I already made the point about quotes.  I was going in to correct them, having already figured out what you just mentioned, when I was faced with the view shown in the screenshot on my initial post.

       

      I don't have a question about quotes.

       

      I do need help though.  Is it possible to bring your MVP abilities to bear on the question I actually asked?

       

      Thanks

      • HansVogelaar's avatar
        HansVogelaar
        MVP

        pauljacobs 

        Once you have displayed the Project Explorer window, double-click ThisWorkbook under the relevant workbook.

        Copy code like this into the ThisWorkbook module:

        Private Sub Workbook_Open()
            Worksheets("Specic Sheet").Select
            MsgBox "Hello There", vbInformation
        End Sub

        Switch back to Excel.

        Save the workbook as a macro-enabled workbook (*.xlsm)

Resources