Hi,
I got Error 1004 while trying to execute the following loop. Actually the Input file Name is in the format "foDDMMMYYYYbhav.csv" i am unable to refer the same format in VBA
Sample code of the loop
Kindly help me how do i define the full path of the file and also to refer the Start Date and Buffer Date in Sheet1 of NSE Converter.xls
Thank you
I got Error 1004 while trying to execute the following loop. Actually the Input file Name is in the format "foDDMMMYYYYbhav.csv" i am unable to refer the same format in VBA
Sample code of the loop
Code:
Sub test()
Dim strPath As String, startPath As String, Endpath As String, i As Long, buffer As String, startDate As Date
startPath = "E:\Macros\Input\" 'current directory
Endpath = "E:\Macros\Output\" 'output path
[COLOR=Red] startDate = "01-JUL-2011" 'DDMMMYYYY
[/COLOR]
Do While buffer <> "2011-07-02"
buffer = Format$(startDate, "DDMMYYYY")
[COLOR=Red]strPath = startPath & "fo" & buffer & "bhav.csv" [/COLOR] 'full path of the file you want to open
startDate = startDate + 1 'add one day
Workbooks.Open Filename:=(strPath)
Kindly help me how do i define the full path of the file and also to refer the Start Date and Buffer Date in Sheet1 of NSE Converter.xls
Thank you