vanishing vba

LisaGreen
5StarLounger
Posts: 964
Joined: 08 Nov 2012, 17:54

vanishing vba

Post by LisaGreen »

Hi, I'm using w11 & excel 2016 64 bit.

Anyone had problems writing vb code, saving it and when coming back to it isn't there please.

Lisa

User avatar
HansV
Administrator
Posts: 79365
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: vanishing vba

Post by HansV »

Did you save the workbook as .xlsx instead of as .xlsm or .xlsb?
Best wishes,
Hans

LisaGreen
5StarLounger
Posts: 964
Joined: 08 Nov 2012, 17:54

Re: vanishing vba

Post by LisaGreen »

Nope. Tried numerous times now.

Lisa.

User avatar
HansV
Administrator
Posts: 79365
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: vanishing vba

Post by HansV »

Please try the following experiment:

- Create a workbook and save it as a macro-enabled workbook (.xlsm).
- Activate the Visual Basic Editor.
- Insert a module and create some code, for example

Code: Select all

Sub Test()
    Beep
End Sub
- You should still see the code in the module window.
- In addition, you can see the module in the Project Explorer pane on the left.
- Now save the workbook from the Visual Basic Editor (press Ctrl+S or click the Save button on the Standard toolbar or select File > Save).
- Does the module disappear? If not, does the code disappear from the module window?
Best wishes,
Hans

snb
5StarLounger
Posts: 613
Joined: 14 Nov 2012, 16:06

Re: vanishing vba

Post by snb »

Is the directory where you save this file a 'trusted location' ? (Trust center wise)

LisaGreen
5StarLounger
Posts: 964
Joined: 08 Nov 2012, 17:54

Re: vanishing vba

Post by LisaGreen »

Ok, I'll bite.

How do I tell if a folder is special?

Lisa

User avatar
SpeakEasy
5StarLounger
Posts: 611
Joined: 27 Jun 2021, 10:46

Re: vanishing vba

Post by SpeakEasy »

File > Options > Trust Center > Trust Center Settings > Trusted Locations

LisaGreen
5StarLounger
Posts: 964
Joined: 08 Nov 2012, 17:54

Re: vanishing vba

Post by LisaGreen »

Hey Speakeasy,

Thanks for replying. Is this possible using VBA do you know??

snb
5StarLounger
Posts: 613
Joined: 14 Nov 2012, 16:06

Re: vanishing vba

Post by snb »

Luckily not, since in that case the Trust Center would be useless.

LisaGreen
5StarLounger
Posts: 964
Joined: 08 Nov 2012, 17:54

Re: vanishing vba

Post by LisaGreen »

Ahhhhh yes. I got this when I thought about it.
Lisa

LisaGreen
5StarLounger
Posts: 964
Joined: 08 Nov 2012, 17:54

Re: vanishing vba

Post by LisaGreen »

Still looking at this.

Lisa