none
Run Time Error 1004 in VBA RRS feed

  • Question

  • I am using VBA to load data from spread sheets that are saved on a network drive to a network workbook. I am getting run time error 1004 and the VBA is stopping on  ActiveWorkbook.SaveAs Filename:=varManuallyProcessPath & varManuallyProcessFile, _
                        FileFormat:=xlOpenXMLWorkbook, Password:="", WriteResPassword:="", _
                        ReadOnlyRecommended:=False, CreateBackup:=False

    I have checked my my path is appears to be correct.

    Thank you for any assistance.

    Thursday, May 30, 2013 3:15 PM

Answers

  • Which is what? xlOpenXMLWorkbook as the type requires .xml as the extension. does varThatWorkbook have .xml as its extension?
    Thursday, May 30, 2013 9:04 PM

All replies

  • What are the contents of varManuallyProcessPath and varManuallyProcessFile?

    Put this just before that line of code:

    Msgbox varManuallyProcessPath & varManuallyProcessFile

    Does it show a valid path and filename?

    How about this? (If you forgot the \)

    Msgbox varManuallyProcessPath & "\" & varManuallyProcessFile

    Thursday, May 30, 2013 5:04 PM
  • This is my contencts of VarManually

     Else
                    varInformation = MsgBox("LGC-203 FORM IS OUT OF DATE - SAVING FILE TO MANUALLY PROCESS FORMS FOLDER", vbInformation, "ERROR MESSAGE")
                    varManuallyProcessPath = "\\ncdst-fiprn01\lgc\Share\User\LGC203\2013 6-30\Tashara - In Process reports\203s Process Manually (Excel)\"
                    varManuallyProcessFile = varThatWorkbook

    Thursday, May 30, 2013 5:19 PM
  • What is in either varManuallyProcessFile or varThatWorkbook?

    varManuallyProcessFile = varThatWorkbook

    Thursday, May 30, 2013 5:32 PM
  • I'm not sure of your question. There are numeric characters in these spreadsheets and workbooks. the files contain these workbooks.
    Thursday, May 30, 2013 5:35 PM
  • When you are doing the SaveAs, you need to pass a valid filepath and filename string to the method. When I asked "What is in either varManuallyProcessFile or varThatWorkbook?" I really meant what values do either of those variables contain/

    Since your code uses

    ActiveWorkbook.SaveAs Filename:=varManuallyProcessPath & varManuallyProcessFile

    the two variables varManuallyProcessPath & varManuallyProcessFile need to produce a valid filename. Your code included the line

    varManuallyProcessFile = varThatWorkbook

    but neither of those variables were shown as being assigned string values in your code, along the lines of

    varThatWorkbook = "Valid Filename.xlsx"

    So, a more accurate question: what string is assigned to the variable varThatWorkbook?


    Thursday, May 30, 2013 7:54 PM
  • varThatWorkbook = ActiveWorkbook.Name

    Thursday, May 30, 2013 8:11 PM
  • Which is what? xlOpenXMLWorkbook as the type requires .xml as the extension. does varThatWorkbook have .xml as its extension?
    Thursday, May 30, 2013 9:04 PM