VB File Appeared to be saving but then disappears RRS feed

  • Question

  • Dear All

    I have been using the following macro to save a file that appears to have disappeared.  The macro is:

    Sub Save_MonthsSheet()

    'Save with current name
                On Error Resume Next
                ' New directory name
                strDirname = Sheets("Control Sheet").Range("K9").Value
                'New file name
                strFilename = Sheets("Control Sheet").Range("K10").Value
                'Default path name
                strDefpath = "G:\Administration\Finance\Mangt Acs\Month End\" & Sheets("Control Sheet").Range("K11").Value & "\" & Sheets("Control Sheet").Range("K12").Value & "\Other\PI\"
                If IsEmpty(strDirname) Then Exit Sub
                If IsEmpty(strFilename) Then Exit Sub
                MkDir strDefpath & strDirname
                strPathname = strDefpath & strDirname & "\" & strFilename 'create total string
                ActiveWorkbook.SaveAs Filename:=strPathname, _
                FileFormat:=xlOpenXMLWorkbookMacroEnabled, Password:="", WriteResPassword:="", _
                ReadOnlyRecommended:=False, CreateBackup:=False

    MsgBox "New Document is Saved"
    End Sub


    The G: drive is a networked drive operating on a Windows XP at work.  Now the file has saved consistently in the past and could have been found in the specified location, but as I processed more information through the model and then run the save sub routine it would perform,  but I cannot find the file when looking for it.



    Kurt Stephen
    • Moved by Mike Feng Tuesday, August 9, 2011 7:41 AM VBA (From:Visual Basic General)
    Thursday, August 4, 2011 8:43 AM

All replies