Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default VBA editor doesn't prompt to save changes, doesn't save

I'm wondering if this is a bug, or if I should have known this; I just
verified that when I open an .xla file (not adding it as an addin using
Excel, just doubleclicking right on it to open it) and make changes in the
VBA editor, when I close it it doesn't prompt to save changes, and it
doesn't save the changes. I have to remember to save.

This ALSO happens when I have it in the workbook as an Add-In. if I make
changes in the vba editor, then close the editor, no prompt. Then saving the
workbook doesn't save the vba changes either.

I found this out by losing about 15 hours of work. I know I'm not a
high-level programmer, but I thought I was beyond this kind of mistake.
None of my code has anything about turning off warnings or save prompts, I
had one bit that turned off screenupdating, but even if I interruped some
code, that being off wouldn't losr my save promots, right? I get save
prompts when I close a Workbook.

Is this by design? That I can work for 15 hours in the Excel vba editor,
and get no save and no prompt to save when I close it?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 621
Default VBA editor doesn't prompt to save changes, doesn't save

Changes to an add-in will not prompt for saving when closing the add-in.

Add this event code to add-in's Thisworkbook module.

Sub Workbook_BeforeClose(Cancel As Boolean)
With ActiveWorkbook
If Not Me.Saved Then
msg = "Do You Want Save Changes to "
msg = msg & Me.Name & "?"
ans = MsgBox(msg, vbQuestion + vbYesNoCancel)
Select Case ans
Case vbYes
Me.Save
Case vbNo
Me.Saved = True
Case vbCancel
Cancel = True
Exit Sub
End Select
End If
'Delete_Controls 'runs macro to delete controls
End With
End Sub

Note...........if addin has workbook_open code to add controls to menus or
toolbars you must add some code to delete those controls.


Gord Dibben MS Excel MVP


On Sun, 17 Oct 2010 21:26:37 -0400, "CompleteNewb"
wrote:

I'm wondering if this is a bug, or if I should have known this; I just
verified that when I open an .xla file (not adding it as an addin using
Excel, just doubleclicking right on it to open it) and make changes in the
VBA editor, when I close it it doesn't prompt to save changes, and it
doesn't save the changes. I have to remember to save.

This ALSO happens when I have it in the workbook as an Add-In. if I make
changes in the vba editor, then close the editor, no prompt. Then saving the
workbook doesn't save the vba changes either.

I found this out by losing about 15 hours of work. I know I'm not a
high-level programmer, but I thought I was beyond this kind of mistake.
None of my code has anything about turning off warnings or save prompts, I
had one bit that turned off screenupdating, but even if I interruped some
code, that being off wouldn't losr my save promots, right? I get save
prompts when I close a Workbook.

Is this by design? That I can work for 15 hours in the Excel vba editor,
and get no save and no prompt to save when I close it?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default VBA editor doesn't prompt to save changes, doesn't save

Thanks, Gord.

I must say I'm very surprised not to have found any questions about this on
the web. It seems like very surprising beahviour, and I guess you need to be
kind of an insider to know it. I'm surprised no one's been on that cusp
when they're just making an add-in for the first time and has never been
surprised by this.

Thanks again.


"Gord Dibben" wrote in message
...
Changes to an add-in will not prompt for saving when closing the add-in.

Add this event code to add-in's Thisworkbook module.

Sub Workbook_BeforeClose(Cancel As Boolean)
With ActiveWorkbook
If Not Me.Saved Then
msg = "Do You Want Save Changes to "
msg = msg & Me.Name & "?"
ans = MsgBox(msg, vbQuestion + vbYesNoCancel)
Select Case ans
Case vbYes
Me.Save
Case vbNo
Me.Saved = True
Case vbCancel
Cancel = True
Exit Sub
End Select
End If
'Delete_Controls 'runs macro to delete controls
End With
End Sub

Note...........if addin has workbook_open code to add controls to menus or
toolbars you must add some code to delete those controls.


Gord Dibben MS Excel MVP


On Sun, 17 Oct 2010 21:26:37 -0400, "CompleteNewb"

wrote:

I'm wondering if this is a bug, or if I should have known this; I just
verified that when I open an .xla file (not adding it as an addin using
Excel, just doubleclicking right on it to open it) and make changes in the
VBA editor, when I close it it doesn't prompt to save changes, and it
doesn't save the changes. I have to remember to save.

This ALSO happens when I have it in the workbook as an Add-In. if I make
changes in the vba editor, then close the editor, no prompt. Then saving
the
workbook doesn't save the vba changes either.

I found this out by losing about 15 hours of work. I know I'm not a
high-level programmer, but I thought I was beyond this kind of mistake.
None of my code has anything about turning off warnings or save prompts, I
had one bit that turned off screenupdating, but even if I interruped some
code, that being off wouldn't losr my save promots, right? I get save
prompts when I close a Workbook.

Is this by design? That I can work for 15 hours in the Excel vba editor,
and get no save and no prompt to save when I close it?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 621
Default VBA editor doesn't prompt to save changes, doesn't save

I don't know if there is guide on add-ins with respect to "close without asking"

I believe I learned from experience as you have.

Generally when developing an add-in I work on a simple workbook to make all
changes to code and/or adding/ deleting modules.

If you close that workbook you will be asked to save changes.

When finished with your developing, save the simple workbook as an Add-in.

Later on if making major alterations that will involve time, don't forget that
you can change IsAddin from True to False whilst developing.


Gord

On Tue, 19 Oct 2010 08:04:18 -0400, "CompleteNewb"
wrote:

Thanks, Gord.

I must say I'm very surprised not to have found any questions about this on
the web. It seems like very surprising beahviour, and I guess you need to be
kind of an insider to know it. I'm surprised no one's been on that cusp
when they're just making an add-in for the first time and has never been
surprised by this.

Thanks again.


"Gord Dibben" wrote in message
.. .
Changes to an add-in will not prompt for saving when closing the add-in.

Add this event code to add-in's Thisworkbook module.

Sub Workbook_BeforeClose(Cancel As Boolean)
With ActiveWorkbook
If Not Me.Saved Then
msg = "Do You Want Save Changes to "
msg = msg & Me.Name & "?"
ans = MsgBox(msg, vbQuestion + vbYesNoCancel)
Select Case ans
Case vbYes
Me.Save
Case vbNo
Me.Saved = True
Case vbCancel
Cancel = True
Exit Sub
End Select
End If
'Delete_Controls 'runs macro to delete controls
End With
End Sub

Note...........if addin has workbook_open code to add controls to menus or
toolbars you must add some code to delete those controls.


Gord Dibben MS Excel MVP


On Sun, 17 Oct 2010 21:26:37 -0400, "CompleteNewb"

wrote:

I'm wondering if this is a bug, or if I should have known this; I just
verified that when I open an .xla file (not adding it as an addin using
Excel, just doubleclicking right on it to open it) and make changes in the
VBA editor, when I close it it doesn't prompt to save changes, and it
doesn't save the changes. I have to remember to save.

This ALSO happens when I have it in the workbook as an Add-In. if I make
changes in the vba editor, then close the editor, no prompt. Then saving
the
workbook doesn't save the vba changes either.

I found this out by losing about 15 hours of work. I know I'm not a
high-level programmer, but I thought I was beyond this kind of mistake.
None of my code has anything about turning off warnings or save prompts, I
had one bit that turned off screenupdating, but even if I interruped some
code, that being off wouldn't losr my save promots, right? I get save
prompts when I close a Workbook.

Is this by design? That I can work for 15 hours in the Excel vba editor,
and get no save and no prompt to save when I close it?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
prompt user to save file as {desired_name} and save it to a variab GeneWan Excel Programming 1 January 5th 07 06:46 AM
save prompt for user exit, but no save prompt for batch import? lpj Excel Discussion (Misc queries) 1 February 25th 06 02:08 AM
Customized VBA Editor Format Save Location Jerry N Excel Programming 0 August 12th 05 02:37 PM
Prompt to save changes sanj Excel Programming 6 April 28th 05 12:06 AM
Save As... prompt darryl26 Excel Programming 1 August 13th 04 09:31 PM


All times are GMT +1. The time now is 11:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"