Hi Guy's i am wondering how close i maybe with this one, i am wanting to underline each row in Excel dependant on recordset qty
So if rs.recordcount = 22 then underline 22 rows
columns always start from A to F as there are 6 fields in the recordset
The titles on the excel form is row A so recordset count starts at B (row2)
This code below doesn't stall but doesn't underline ?
Dims are all ok b9 and m9 are strings
startrow, Col EndRow, Col are Integers
pOpen (path open) fOpen (File Open) and pSave (Path Save) and fSave (File Save) are all strings
It doesn't stall to tell what isn't correct but but doesn't underline ???
Code:
Set rsOut = CurrentDb.OpenRecordset("Select tblRemovals.RecordNo, tblRemovals.Client, tblRemovals.Town, tblRemovals.Make, tblRemovals.Model, tblRemovals.SerialNo " _& "From tblRemovals WHERE Make = '" & b9 & "' And Model = '" & m9 & "' And Status = '" & myStatus & "' ORDER BY RecordNo;")
StartRow = 2
EndRow = rsOut.RecordCount
StartCol = 1
EndCol = 6
Set apXL = CreateObject("Excel.Application")
Set xlWB = apXL.Workbooks.Open(pSave & fSave)
apXL.Workbooks.Open pSave & fSave, True, False
apXL.Visible = True
With xlWB
.Worksheets(1).Cells(2, 1).CopyFromRecordset rsOut
.Worksheets(1).Cells.EntireColumn.AutoFit
.Worksheets(1).Range(StartCol & StartRow & ":" & EndCol & EndRow).Borders(xlEdgeBottom).LineStyle = xlContinuous