I have a loop that is going through all the dates within a submitted range by a user.
For each date in the loop though, I want to format it back to string value such as 09/01/2016 ---> 09012016 to do a file search in a directory with this at the end of the file name.
Only thing is, I'm confused how to make the date back to a string value in that format.
Cstr did not work as planned, any other ideas?
The below is my code:
![]()
Public dateRange As String Public StartDate As String Public EndDate As String ------------------------------------ With ReqSFTP .StartUpPosition = 0 .Left = Application.Left + (0.5 * Application.Width) - (0.5 * .Width) .Top = Application.Top + (0.5 * Application.Height) - (0.5 * .Height) .Show StartDate = .fromBox.Value EndDate = .toBox.Value UserN = .uidBox.Value Password = .pwdBox.Value End With Dim FilePath1 As String Dim FilePath2 As String Dim Starting As Date Dim Ending As Date Starting = DateSerial(CInt(Right(StartDate, 4)), CInt(Left(StartDate, 2)), CInt(Mid(StartDate, 3, 2))) Ending = DateSerial(CInt(Right(EndDate, 4)), CInt(Left(EndDate, 2)), CInt(Mid(EndDate, 3, 2))) Dim d As Date For d = Starting To Ending dateRange = " range converted back to text formula" FilePath1 = "/reports/*" & dateRange & ".csv" FilePath2 = "/reports/*" & dateRange & ".csv" Set transferResult = mySession.GetFiles(FilePath1, "F:\SFTP\Downloads\", False, myTransferOptions) Set transferResult = mySession.GetFiles(FilePath2, "F:\SFTP\Downloads\", False, myTransferOptions) Next











LinkBack URL
About LinkBacks
Register To Reply
Bookmarks