D
Dkline
I'm getting a "Compile Error" "Syntax Error" on the last line of the
subroutine:
CopySourceFiles(strDailyPath,strDailyName,strlocalpath)
As you can see the last argument is not being acccepted as it is all lower
case rather than the mixed case in the Dim.
For some reason it doesn't like the third argument. Basic purpose of this
code is to copy seven files from various network locations into a local
subdirectory
Below is the entire code:
Option Explicit
Dim wbFilesDailyUpdate As Workbook
Dim wsFiles As Worksheet
Dim strLocalPath As String
Dim strGetFilePath As String
Dim strGetFile As String
Dim strDailyPath As String
Dim strAndesaPath As String
Dim strTransactionsPath As String
Dim strDailyName As String
Dim strSingleName As String
Dim strJointName As String
Dim strAnnuityName As String
Dim strTablesName As String
Dim strTransactionsName As String
Dim strDCTableName As String
Dim strGetPathFile As String
Dim strCopyToPathFile As String
Sub GetCurrentFiles()
Set wbFilesDailyUpdate = ThisWorkbook
Set wsFiles = wbFilesDailyUpdate.Worksheets("Files")
strLocalPath = wsFiles.Range("LocalPath").Value
'Get Daily Balance File
strDailyPath = wsFiles.Range("DailyPath").Value
strDailyName = wsFiles.Range("DailyName").Value
CopySourceFiles(strDailyPath,strDailyName,strlocalpath)
End Sub
Function CopySourceFiles(GetPath, GetFile, ToPath)
strCopyToPathFile = ToPath & "\" & GetFile
strGetPathFile = GetPath & "\" & GetFile
FileCopy strGetPathFile, strCopyToPathFile
End Function
subroutine:
CopySourceFiles(strDailyPath,strDailyName,strlocalpath)
As you can see the last argument is not being acccepted as it is all lower
case rather than the mixed case in the Dim.
For some reason it doesn't like the third argument. Basic purpose of this
code is to copy seven files from various network locations into a local
subdirectory
Below is the entire code:
Option Explicit
Dim wbFilesDailyUpdate As Workbook
Dim wsFiles As Worksheet
Dim strLocalPath As String
Dim strGetFilePath As String
Dim strGetFile As String
Dim strDailyPath As String
Dim strAndesaPath As String
Dim strTransactionsPath As String
Dim strDailyName As String
Dim strSingleName As String
Dim strJointName As String
Dim strAnnuityName As String
Dim strTablesName As String
Dim strTransactionsName As String
Dim strDCTableName As String
Dim strGetPathFile As String
Dim strCopyToPathFile As String
Sub GetCurrentFiles()
Set wbFilesDailyUpdate = ThisWorkbook
Set wsFiles = wbFilesDailyUpdate.Worksheets("Files")
strLocalPath = wsFiles.Range("LocalPath").Value
'Get Daily Balance File
strDailyPath = wsFiles.Range("DailyPath").Value
strDailyName = wsFiles.Range("DailyName").Value
CopySourceFiles(strDailyPath,strDailyName,strlocalpath)
End Sub
Function CopySourceFiles(GetPath, GetFile, ToPath)
strCopyToPathFile = ToPath & "\" & GetFile
strGetPathFile = GetPath & "\" & GetFile
FileCopy strGetPathFile, strCopyToPathFile
End Function