XL: Workbooks Containing User Forms Take Excessively Long Time to Save Across WAN Connections

This article was previously published under Q254733
This article has been archived. It is offered "as is" and will no longer be updated.
Symptoms
When you save Excel workbooks that contain user forms, it typically takes about one minute to save to the local computer or within the local area network (LAN). When you save the same workbooks over a wide area network (WAN), it can take an excessive amount of time.
Cause
When Excel saves a user form, it writes out each control separately, and waits for an acknowledgement from the network before proceeding to the next control. The amount of time it takes to save is relative to the number of controls and user forms, and the network and remote drive latency.
Workaround
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs.
If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites:

Microsoft Certified Partners - https://partner.microsoft.com/global/30000104

Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMSTo work around this problem, the following Microsoft Visual Basic for Applications (VBA) macros copy the document to the local drive, and then share that local copy back to the WAN.

To implement the workaround, follow these steps:
  1. Start Excel and open the VBA editor by pressing ALT+F11.
  2. On the Insert menu, click Module.
  3. Type the following code in the new module:
    Option ExplicitPrivate Const TEMPFILE As String = "c:\dlocal.xls" 'Note, ensure the file path is valid.Private Const TEMPFILE2 As String = "c:\dlocal2.xls" 'Note, ensure the file path is valid.Private strOriginalName As StringPublic bSaving As BooleanPublic Sub SaveLocalThenCopy()    Dim wbk As Workbook, wbk2 As Workbook    Set wbk = ThisWorkbook    If UCase(ThisWorkbook.FullName) <> UCase(TEMPFILE) Then strOriginalName = ThisWorkbook.FullName    If Dir(TEMPFILE) <> "" Then Kill TEMPFILE    If Dir(TEMPFILE2) <> "" Then Kill TEMPFILE2    ThisWorkbook.SaveAs TEMPFILE    ThisWorkbook.SaveAs TEMPFILE2    FileCopy TEMPFILE, strOriginalName    Set wbk2 = Workbooks.Open(strOriginalName)    bSaving = False    wbk.Close FalseEnd Sub						
    The following steps add code to the workbook's BeforeSave event to run the workaround above.
  4. In the VBAProject window, double-click the ThisWorkbook icon to open the Code window.
  5. At the top of this new Code window, there are two drop-down lists. In the Object (left) list, click Workbook; in the Procedure (right) list, click BeforeSave.
  6. Type the following code in the Code window:
    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)    If bSaving Then Cancel = False: Exit Sub    Dim iAns As Integer    iAns = MsgBox("Do you wish to Save As...?", vbYesNoCancel, "Save")    Select Case iAns        Case vbYes            Cancel = True            bSaving = True            Application.Dialogs(xlDialogSaveAs).Show            bSaving = False            Exit Sub        Case vbNo            'Do normal - local save.        Case vbCancel            Cancel = True            Exit Sub    End Select    bSaving = True    Cancel = True    Application.OnTime Now + TimeValue("00:00:01"), "SaveLocalThenCopy"End Sub					
Now, when you click Save As, Excel prompts you to choose either the default Excel Save As dialog box (click Yes), or to use the workaround above to save the document (click No).
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
slow XL2000 XL97 userform
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.
Properties

Article ID: 254733 - Last Review: 10/25/2013 23:42:00 - Revision: 1.0

Microsoft Excel 2000 Standard Edition, Microsoft Excel 97 Standard Edition

  • kbnosurvey kbarchive kbdtacode kbfix kbprb KB254733
Feedback