M
ML
I'm newbie to group - but not in VBA - Access.
I'm generating Excel workbook/sheets etc on the fly and it works! -
except...
I have a loop which
1. copies a template workbook - vba
2 opens it as an Excel object etc
3 assigns hyperlinks to cells
ETC
n. quits the application
n+1 sets application to nothing
This works perfectly for the first loop iteration
next time round it does 1 and 2 but fails on 3
oWrkSh.Cells(i + 6, "F") = Employees(i)
RangeCells = "H" & CStr(i + 6) & ":I" & CStr(i + 6)
oWrkSh.Range(RangeCells).Select
FAILS NEXT STATEMENT even though it was ok for the 1st iteration - workbook
oWrkSh.Hyperlinks.Add Anchor:=Selection, _
Address:="", SubAddress:="'" & Employees(i) & " (Leads)'" & "!A1",
TextToDisplay:="Leads Report"
error says automation error - can't add hyperlink or thereabouts
Any ideas?
TIA Michael
I'm generating Excel workbook/sheets etc on the fly and it works! -
except...
I have a loop which
1. copies a template workbook - vba
2 opens it as an Excel object etc
3 assigns hyperlinks to cells
ETC
n. quits the application
n+1 sets application to nothing
This works perfectly for the first loop iteration
next time round it does 1 and 2 but fails on 3
oWrkSh.Cells(i + 6, "F") = Employees(i)
RangeCells = "H" & CStr(i + 6) & ":I" & CStr(i + 6)
oWrkSh.Range(RangeCells).Select
FAILS NEXT STATEMENT even though it was ok for the 1st iteration - workbook
oWrkSh.Hyperlinks.Add Anchor:=Selection, _
Address:="", SubAddress:="'" & Employees(i) & " (Leads)'" & "!A1",
TextToDisplay:="Leads Report"
error says automation error - can't add hyperlink or thereabouts
Any ideas?
TIA Michael