+ Reply to Thread
Results 1 to 4 of 4

++++++PLEASE HELP++++++

  1. #1
    Chris
    Guest

    ++++++PLEASE HELP++++++

    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.

  2. #2
    KL
    Guest

    Re: ++++++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" <[email protected]> wrote in message
    news:[email protected]...
    > 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.




  3. #3
    Chris
    Guest

    Re: ++++++PLEASE HELP++++++

    This seams to have worked.

    Thanks

    "KL" wrote:

    > 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" <[email protected]> wrote in message
    > news:[email protected]...
    > > 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.

    >
    >
    >


  4. #4
    Vic Eldridge
    Guest

    RE: ++++++PLEASE HELP++++++

    Hi Chris,

    Look at the Saved property of the Workbook object to see if any changes have
    been made.

    Regards,
    Vic Eldridge


    "Chris" wrote:

    > 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.


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1