Consulting

Results 1 to 4 of 4

Thread: Advice: Save vs BackgroundSave

  1. #1
    VBAX Mentor XL-Dennis's Avatar
    Joined
    May 2004
    Location
    ?stersund, Sweden
    Posts
    499
    Location

    Advice: Save vs BackgroundSave

    Hi All :hi

    Are there any advantage (speed / performance) to use BackgroundSave instead of the Save-command?

    Kind regards,
    Dennis
    Kind regards,
    Dennis

    ExcelKB | .NET & Excel | 2nd edition PED


  2. #2
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location

    Background Saves

    No. In fact using background save uses up more resources. If you want to conserve system resources, you may want to turn it off.

    Also, hopefully you also turn OFF fast saves under the Save tab. Not sure if it is relevant for you, but even if you have fast save enabled, if the file is on a network drive, it is ignored. Fast save ONLY works on local drives.
    Last edited by Anne Troy; 05-25-2004 at 11:43 AM.

  3. #3
    VBAX Mentor XL-Dennis's Avatar
    Joined
    May 2004
    Location
    ?stersund, Sweden
    Posts
    499
    Location
    Hi Gerry,

    Thanks for the information and what I conclude is that the following example is the best one to go with:

    [vba]
    Option Explicit
    Sub test()
    Dim wdDoc As Document
    Dim bStatus As Boolean
    Set wdDoc = ActiveDocument
    With Options
    bStatus = .BackgroundSave
    .BackgroundSave = False
    wdDoc.Save
    .BackgroundSave = bStatus
    End With
    End Sub
    [/vba]

    Kind regards,
    Dennis
    Kind regards,
    Dennis

    ExcelKB | .NET & Excel | 2nd edition PED


  4. #4
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    Well yes, but strictly speaking, the code is applying content to different objects.

    Options.anything is a property of the Application object, not the Document object.

    So unless you are doing something more involved, it is not needed to declare wdDoc as ActiveDocument. The With.Options is not doing anything at all to the wdDoc object. You should also Set wdDoc = Nothing at the end.

    That being said, it certainly is good practice to record the state of properties, and return them once you are done. In this case though, if backgroundsave = true, you will be returning the application back to backgroundsave. My point was that backgroundsave, if resources are critical, should be off, and stay off.

Posting Permissions

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