• Excel Save Location

    Author
    Topic
    #351711

    You might find the solution to my previous post of the same name interesting if not amusing… The code is rather sloppy as I was testing the final idea (see previous post), but it works.

    On Error Resume Next
        Set xlApp = CreateObject("Excel.Application")
        If Err.Number  0 Then
            MsgBox "Error: Could not start Excel."
        Else
            strUserDefaultExcelPath = xlApp.DefaultFilePath
            xlApp.DefaultFilePath = vDrv + ROOTFOLDER + "" + FormName
            xlApp.Quit
            Set xlApp = Nothing
            'In order to set the default folder, Excel must be closed. So now reopen and proceed.
            Set xlApp = CreateObject("Excel.Application")
            If Err.Number  0 Then
                MsgBox "Error: Could not start Excel."
            Else
                StartExcelSuccess = True
            End If
        End If
    

    This little anomally about Excel has plagued me for over a year. Today we celebrate!

    Reply To: Excel Save Location

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: