ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA macro does not save (https://www.excelbanter.com/excel-programming/314296-vba-macro-does-not-save.html)

Brian Gideon

VBA macro does not save
 
When I save a workbook that have just created and reopen it all of my
VBA code that I wrote is gone. I've been doing this for years and I've
never had this problem until now. I've checked all of the options I
can think of and I can't find anything that would affect saving macros.
I can change the cell contents on a sheet and I can see those changes
after saving, closing, and reopening so why are my macros not saved?
I'm using Excel 2003. I don't have this problem on other machines with
the same version so it appears that it might be isolated to my machine.
Suggestions?


Josh Sale

VBA macro does not save
 
Brian, I have a workbook that has the same problem. Here's how I've worked
around it:

- Launch Excel, goto the VBE, the General tab of Tools | Options and make
sure that Notify Before State Loss is checked.

- Open your workbook.

- Go to the VBE and open up some code module in your project.

- Now do something to reset your project. What I do is to Cut the Option
Explicit out of my program. If you are successful in resetting the project
you will get a prompt confirming the reset of the project. Say OK to the
prompt.

- Now Paste back your Option Explicit and perform a Debug | Compile of your
project.

- Now try to save workbook.

Its a pain in the butt to have to do this each time, but that's where I'm
at. I'm guessing this problem is caused by workbook size.

Hope this works for you.

josh



N10

VBA macro does not save
 
HI Brian

JUst a random thought on this..are you perhapes saving the macros in your
personal.xls file rather than with the "this woprkbook " option ?

Best N10

"Brian Gideon" wrote in message
oups.com...
When I save a workbook that have just created and reopen it all of my
VBA code that I wrote is gone. I've been doing this for years and I've
never had this problem until now. I've checked all of the options I
can think of and I can't find anything that would affect saving macros.
I can change the cell contents on a sheet and I can see those changes
after saving, closing, and reopening so why are my macros not saved?
I'm using Excel 2003. I don't have this problem on other machines with
the same version so it appears that it might be isolated to my machine.
Suggestions?




Myrna Larson

VBA macro does not save
 
Have you used Rob Bovey's VBA Code Cleaner on this workbook? Sounds like it
may be corrupted, in which case, all sorts of disasters could befall you/it.


On Thu, 21 Oct 2004 10:36:05 -0600, "Josh Sale" <jsale@tril dot cod wrote:

Brian, I have a workbook that has the same problem. Here's how I've worked
around it:

- Launch Excel, goto the VBE, the General tab of Tools | Options and make
sure that Notify Before State Loss is checked.

- Open your workbook.

- Go to the VBE and open up some code module in your project.

- Now do something to reset your project. What I do is to Cut the Option
Explicit out of my program. If you are successful in resetting the project
you will get a prompt confirming the reset of the project. Say OK to the
prompt.

- Now Paste back your Option Explicit and perform a Debug | Compile of your
project.

- Now try to save workbook.

Its a pain in the butt to have to do this each time, but that's where I'm
at. I'm guessing this problem is caused by workbook size.

Hope this works for you.

josh



Brian Gideon

VBA macro does not save
 
Josh,

Thanks for the reply. While I was going through your suggested
procedure I discovered (by accident) that if I create a new module and
put the code in there then it will save correctly. The code is lost if
I put it in Sheet1, Sheet2, Sheet3, or ThisWorkbook, etc. despite the
fact that it can be executed and debugged without problems. I'm still
not exactly sure what's going on, but at least I have a work-around for
now. Thanks.

Brian


Josh Sale

VBA macro does not save
 
Creating a new module probably resets the project.


"Brian Gideon" wrote in message
oups.com...
Josh,

Thanks for the reply. While I was going through your suggested
procedure I discovered (by accident) that if I create a new module and
put the code in there then it will save correctly. The code is lost if
I put it in Sheet1, Sheet2, Sheet3, or ThisWorkbook, etc. despite the
fact that it can be executed and debugged without problems. I'm still
not exactly sure what's going on, but at least I have a work-around for
now. Thanks.

Brian




Brian Gideon

VBA macro does not save
 
I fixed my problem and I thought I'd share the solution in case someone
googled and found this thread. It seems that my profile was corrupted.
I rebooted my machine and logged in using a different username with
administrative privileges and deleted the profile associated with my
username by going into Control Panel | System | Advanced tab | User
Profiles Settings. The next time you log in WinXP will create a new
profile. Remember that you will of course lose all profile specific
settings, data, and documents so be sure to backup anything that is
important.

Brian

Brian Gideon wrote:
When I save a workbook that have just created and reopen it all of my
VBA code that I wrote is gone. I've been doing this for years and

I've
never had this problem until now. I've checked all of the options I
can think of and I can't find anything that would affect saving

macros.
I can change the cell contents on a sheet and I can see those changes
after saving, closing, and reopening so why are my macros not saved?
I'm using Excel 2003. I don't have this problem on other machines

with
the same version so it appears that it might be isolated to my

machine.
Suggestions?




All times are GMT +1. The time now is 05:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com