I trying to create an Excel workbook from Access and then do some formatting
of the workbook. I did quite a bit of this with Access 97 a few years back,
but I haven't done much with A2K. So I created some basic code (below) to
get me up and running. But it just bounces out of the formatting sub with no
errors. If I compact the DB, it works once and then stops working again.
Can anyone see any obvious bugs with the snippet below or explain this
issue. I going to move the formatting code to an Excel macro for now, but
I'd like to know what's going on.
Set xlApp = xlBook.Application
'xlApp.Visible = False
'xlApp.ScreenUpdating = False
Set xlSheet = xlApp.Workbooks(1).Worksheets(1)
xlSheet.Activate
'Set UR = xlSheet.UsedRange
'Find our working Range
xlApp.Cells(4, 2).Select
xlApp.Range(Selection, Selection.End(xlDown)).Select
The code returns to the calling sub here (above) with no error, unless I
compile the db and then only works once.
xlApp.Range(Selection, Selection.End(xlRight)).Select
Set UR = Selection