View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
KL KL is offline
external usenet poster
 
Posts: 201
Default ++++++PLEASE HELP++++++

Chris,

Have you tried putting the followig code into ThisWorkbook module?

Regards,
KL

'----------Code Start-----------
Public WBChanged As Boolean

Private Sub Workbook_Open()
WBChanged = False
End Sub

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
WBChanged = True
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If WBChanged = True Then
Me.Save
Else
Me.Saved = True
End If
End Sub

'----------Code End-----------


"Chris" wrote in message
...
Is there a way to use visual basic to only save a workbook when changes
have
been made to it?

I have a large spreadsheet with a VB front end on it, every time I exit it
saves. Even if changes have not been made. I want to avoid this as it
takes a
long time to save.

Please help, I cant find out how to do it anywhere.