LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default 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



 
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
Excel 2007 - error saving file & error loading dll TinaF Excel Discussion (Misc queries) 0 July 1st 09 01:49 PM
Saving Excel 2003 Workbook in Excel 07 - Error Msg on Script obj WL Excel Discussion (Misc queries) 0 January 15th 08 06:20 PM
error message when saving excel workbook Deb Excel Discussion (Misc queries) 1 October 5th 05 08:26 PM
Saving a Workbook: Forcing User to Rename before Saving Rollin_Again[_6_] Excel Programming 5 April 16th 04 02:54 PM
ChartCalculate code causing error when saving workbook Pete McCosh[_5_] Excel Programming 0 February 19th 04 03:00 PM


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

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

About Us

"It's about Microsoft Excel"