Code Fails Saving File

breader

New member
Joined
Nov 27, 2013
Messages
1
Reaction score
0
Points
0
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 a moderator:
Back
Top