strfilename = "X:\ToPost\" & y & "\" & mth & "\ToPost " & Format(Date, "ddmmmyy") & " " & Hour(Now()) & Minute(Now())
h = Hour(Now())
m = Minute(Now())
Set appExcel = Excel.Application
If Dir(strfilename) <> "" Then
Set wbk = appExcel.Workbooks.Open(strfilename & ".xls")
Else
Set wbk = appExcel.Workbooks.Add
wbk.SaveAs strfilename & ".xls"
End If
i = 1
Do While SpreadSht.Worksheets(1).Range("A" & i) <> ""
i = i + 1
Loop
SpreadSht.Worksheets(1).Range("A1:Q" & i - 1).Copy
wbk.Range("A1:Q" & i - 1).Paste
wbk.Save
wbk.Close
I got a popup msg when the programme goes to third last row.
eg: wbk.Range("A1:Q" & i - 1).Paste
It says that Object does not support this method. How can I solve it?
h = Hour(Now())
m = Minute(Now())
Set appExcel = Excel.Application
If Dir(strfilename) <> "" Then
Set wbk = appExcel.Workbooks.Open(strfilename & ".xls")
Else
Set wbk = appExcel.Workbooks.Add
wbk.SaveAs strfilename & ".xls"
End If
i = 1
Do While SpreadSht.Worksheets(1).Range("A" & i) <> ""
i = i + 1
Loop
SpreadSht.Worksheets(1).Range("A1:Q" & i - 1).Copy
wbk.Range("A1:Q" & i - 1).Paste
wbk.Save
wbk.Close
I got a popup msg when the programme goes to third last row.
eg: wbk.Range("A1:Q" & i - 1).Paste
It says that Object does not support this method. How can I solve it?
Last edited: