S
Soonernut
Have a simple macro, works perfectly when step thru, fails a
highlighted point when ran. I added a timer because I thought th
download process took too long and the macro was continuing before th
file completely downloaded.
Any suggestions?
Thanks in advance.
Sub ANDY()
'
' ANDY Macro
' Macro recorded 6/22/2004 by Administrator
'
' Keyboard Shortcut: Ctrl+Shift+Q
'
Range("a1").Select
ActiveCell.FormulaR1C1 = "=TODAY()"
Range("a1").Select
Selection.NumberFormat = "yyyymmdd"
usedate = Format(Sheets("Sheet1").Cells(1, 2), "YYYYMMDD")
Filename = "ftp://ftp.pjm.com/pub/account/lmp/" & usedate & ".csv"
Workbooks.Open Filename:
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 45
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
Cells.Select
Selection.Copy
ActiveWindow.ActivateNext
Sheets("Sheet2").Select
Cells.Select
ActiveSheet.Paste
Sheets("Sheet1").Select
End Su
highlighted point when ran. I added a timer because I thought th
download process took too long and the macro was continuing before th
file completely downloaded.
Any suggestions?
Thanks in advance.
Sub ANDY()
'
' ANDY Macro
' Macro recorded 6/22/2004 by Administrator
'
' Keyboard Shortcut: Ctrl+Shift+Q
'
Range("a1").Select
ActiveCell.FormulaR1C1 = "=TODAY()"
Range("a1").Select
Selection.NumberFormat = "yyyymmdd"
usedate = Format(Sheets("Sheet1").Cells(1, 2), "YYYYMMDD")
Filename = "ftp://ftp.pjm.com/pub/account/lmp/" & usedate & ".csv"
Workbooks.Open Filename:
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 45
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
Cells.Select
Selection.Copy
ActiveWindow.ActivateNext
Sheets("Sheet2").Select
Cells.Select
ActiveSheet.Paste
Sheets("Sheet1").Select
End Su