ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Workbook_Open CommandBar corrupt excel files (https://www.excelbanter.com/excel-programming/438382-workbook_open-commandbar-corrupt-excel-files.html)

Alex St-Pierre

Workbook_Open CommandBar corrupt excel files
 
Hi,
I have 2 macros that create and delete a custom command bar at the opening
and before close.
A) When I save the file and then click on "X" without saving, I can reopen
the file.
B)But when I save the file, click on "X" and click on save, I can't reopen
the file (Excel ask to recover the file).
Does anyone have an idea?
Thank you!
Alex
Private Sub Workbook_Open()
Call CreateCommandBar
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call DeleteCommandBar
End Sub
--
Alex St-Pierre

Dave Peterson

Workbook_Open CommandBar corrupt excel files
 
I think it's coincidence.

Try creating a test workbook with the same routines and save that. I bet it
works ok.

I'm betting that your workbook is corrupted--or on the cusp of being corrupt.

Alex St-Pierre wrote:

Hi,
I have 2 macros that create and delete a custom command bar at the opening
and before close.
A) When I save the file and then click on "X" without saving, I can reopen
the file.
B)But when I save the file, click on "X" and click on save, I can't reopen
the file (Excel ask to recover the file).
Does anyone have an idea?
Thank you!
Alex
Private Sub Workbook_Open()
Call CreateCommandBar
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call DeleteCommandBar
End Sub
--
Alex St-Pierre


--

Dave Peterson


All times are GMT +1. The time now is 02:07 PM.

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