Results 1 to 1 of 1

Thread: Code Fails Saving File

  1. #1

    Code Fails Saving File



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hi

    I am working with 2 files, A and B.

    File A opens File B and then saves File B as file C.

    Then Data gets pasted from File A to File C and then File C is saved as file C

    My code works up to where I want to save file C as file C after pasting data from file A.

    See my note within the code below CODE FAILS HERE

    Thanks for any help on fixing this, Benjamin


    Code:
    Dim WkbFPMaster As Workbook
    Dim WksFPMasterRDF As Worksheet
    Dim WksFPMasterControl As Worksheet
    Dim WkbRDF As Workbook
    Dim WkbFPOFOpen As Workbook
    Dim WkbFPOFSave As Workbook
    
    Set WkbFPMaster = ActiveWorkbook
    Set WksFPMasterRDF = WkbFPMaster.Sheets("RDF")
    Set WksFPMasterControl = WkbFPMaster.Sheets("Control")
    
       
    'LOOPING RECORD DATA FILES
    
        For M = 1 To Range("Max_RDF_Number")
        Range("Current_RDF_Number") = M
        Calculate
        If Range("RDF_Run_Option") = 1 Then
        
    'OPEN FPOF MASTER AND SAVE AS FPOF OUTPUT FILE NAME
            
            Application.DisplayAlerts = False
            Set WbkFPOFOpen = Workbooks.Open(WksFPMasterControl.Range("FPOF_Root_Directory_Open").Value, UpdateLinks:=0)
            WbkFPOFOpen.SaveAs Filename:=(WksFPMasterControl.Range("FPOF_Root_Directory_Save").Value)
            Application.DisplayAlerts = True
        
     'MORE CODE IN HERE
    
           Application.DisplayAlerts = False
           WbkFPOFOpen.SaveAs Filename:=(WksFPMasterControl.Range("FPOF_Root_Directory_Save").Value) 'CODE FAILS HERE
           WbkFPOFOpen.Close (False)
           Application.DisplayAlerts = True
        
    Next M
    Last edited by JoePublic; 2013-11-27 at 09:45 PM. Reason: Add code tags

Posting Permissions

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