Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Saving Workbook Error-Plz help
I have the following code to automatically save the workbook
Private Sub CommandButton3_Click() ThisWorkbook.Save ThisWorkbook.Close End Sub I get this mesage box: "A file named "myfilename.xls" already exists in this location, do you want to replace it?" I dont want this to come up. is there any way around this? Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Saving Workbook Error-Plz help
After the .Save
ThisWorkbook.Saved = True "Jim" wrote: I have the following code to automatically save the workbook Private Sub CommandButton3_Click() ThisWorkbook.Save ThisWorkbook.Close End Sub I get this mesage box: "A file named "myfilename.xls" already exists in this location, do you want to replace it?" I dont want this to come up. is there any way around this? Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Saving Workbook Error-Plz help
Awesome, thanks charlie!!! works great
"Charlie" wrote: After the .Save ThisWorkbook.Saved = True "Jim" wrote: I have the following code to automatically save the workbook Private Sub CommandButton3_Click() ThisWorkbook.Save ThisWorkbook.Close End Sub I get this mesage box: "A file named "myfilename.xls" already exists in this location, do you want to replace it?" I dont want this to come up. is there any way around this? Thanks |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Saving Workbook Error-Plz help
That was the code in sheet 2, and the code in ThisWorkbook is as follows:
Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Data").Activate Columns("A:J").Select If Selection.EntireColumn.Hidden < True Then Selection.EntireColumn.Hidden = True End If sheetprot 'subroutine that protects all sheets ThisWorkbook.Save ThisWorkbook.Close End Sub |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Saving Workbook Error-Plz help
I think this is what your after
Private Sub Workbook_BeforeClose(Cancel As Boolean) Application.DisplayAlerts = False With ThisWorkbook .Save .Close End With Application.DisplayAlerts = True End Sub "Jim" wrote: That was the code in sheet 2, and the code in ThisWorkbook is as follows: Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Data").Activate Columns("A:J").Select If Selection.EntireColumn.Hidden < True Then Selection.EntireColumn.Hidden = True End If sheetprot 'subroutine that protects all sheets ThisWorkbook.Save ThisWorkbook.Close End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2007 - error saving file & error loading dll | Excel Discussion (Misc queries) | |||
Saving Excel 2003 Workbook in Excel 07 - Error Msg on Script obj | Excel Discussion (Misc queries) | |||
error message when saving excel workbook | Excel Discussion (Misc queries) | |||
Saving a Workbook: Forcing User to Rename before Saving | Excel Programming | |||
ChartCalculate code causing error when saving workbook | Excel Programming |