Rename workbook VBA is gone

Myproblem

Board Regular
Joined
May 24, 2010
Messages
198
i have some VBA code in some workbook that is run in "ThisWorkbook" procedure.
when i rename that workbook the VBA is gone.

any idea what to do to prevent this happening.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
What do you understand by renaming? I assume it's not the rename in Windows Explorer, for instance?
 
Upvote 0
thx for replaying
@ Yahya i did that in xlsm format - i am familiar with it

@ wigi it is changing the name of entaire workbook, for instance original name was Name1.xlsm (vba code working)
second name is Name2..xlsm (vba cod is not working)

i have read somewhere about preventig sheet naming to make sure that specific macro is "linked" to specific sheet name and i do not know where i read about it to figure out about problem above
 
Upvote 0
Originally you said the VBA code was gone. Now you say it's not working.

Which is it?
 
Upvote 0
Renaming your workbook in Windows Explorer won't delete any code that's in that workbook.


Are you saying:-
  • the code is in Name1.xlsm
  • you save and close Name1.xlsm
  • you rename it Name2.xlsm
  • you open Name2.xlsm
  • you open the VBA editor and the code has gone
Is that what's happening?
 
Upvote 0
Renaming your workbook in Windows Explorer won't delete any code that's in that workbook.



Are you saying:-
  • the code is in Name1.xlsm
  • you save and close Name1.xlsm
  • you rename it Name2.xlsm
  • you open Name2.xlsm
  • you open the VBA editor and the code has gone
Is that what's happening?

yes it is, i rename it from Name1.xlsm (closed workbook) to Name2.xlsm and VBA code has gone
 
Upvote 0
Hello

Strange case this one...

Where do you rename the workbook? In Windows Explorer, using Ctrl-O in Excel, other method? There is no code involved with the renaming?
 
Upvote 0
Hello

Strange case this one...

Where do you rename the workbook? In Windows Explorer, using Ctrl-O in Excel, other method? There is no code involved with the renaming?

the VBA code is in Name1.xlsm, ThisWorkbook procedure
after I close workbook Name1.xlsm and rename it into Name2.xlsm, no VBA code in that (Name2.xlsm) workbook
 
Upvote 0

Forum statistics

Threads
1,224,538
Messages
6,179,412
Members
452,912
Latest member
alicemil

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top