This is simply weird...
Code I have used dozens of time to manipulate XL files from Access crashes Access.
The only thing that seems to have changed is the installation of KB981716. Sadly this update was on 7/14/10 and my auto restore points have rolled this update off the list and it is not an update that can be uninstalled to properly test short of finding my intallation media which I may do tonight.
This is a fully patched install of Office 2003 where the issue occurs and while some of the XL automation runs, other parts do not. To be on the safe side I have decompiled and recompiled the Access database.
The code snippet that blows up...
Interestingly I have manipulated the failing line once to include the XLAPP object before the .cells and had it pass that line but this does not seem repeatable and I do not know which line it failed on the one time it did pass this.
Any thoughts would be appreciated.
While i do not think this could possibly be relevant, I have also moved my data backend to SQL Express 2008 R2 and the code does use a DAO recordset since I remember successfuly running the code.
Code I have used dozens of time to manipulate XL files from Access crashes Access.
The only thing that seems to have changed is the installation of KB981716. Sadly this update was on 7/14/10 and my auto restore points have rolled this update off the list and it is not an update that can be uninstalled to properly test short of finding my intallation media which I may do tonight.
This is a fully patched install of Office 2003 where the issue occurs and while some of the XL automation runs, other parts do not. To be on the safe side I have decompiled and recompiled the Access database.
The code snippet that blows up...
Code:
'A lot of code removed for brevity
Dim XLAPP As Excel.Application
Set XLAPP = CreateObject("Excel.Application")
With XLAPP
.Workbooks.Open FileName:= _
strFilePath
If strNewPath <> "" Then
.ActiveWorkbook.SaveAs FileName:=strNewPath _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
'Bunch of code that manipulates file makes a selection...
'The below crashes
.Selection.Sort Key1:=.Cells(1, RS!Detail_Column), Order1:=xlAscending, Header:=IIf(RS!Has_Header_Row, xlYes, xlNo), _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
'More manipulation and saving file etc.
End With
Interestingly I have manipulated the failing line once to include the XLAPP object before the .cells and had it pass that line but this does not seem repeatable and I do not know which line it failed on the one time it did pass this.
Any thoughts would be appreciated.
While i do not think this could possibly be relevant, I have also moved my data backend to SQL Express 2008 R2 and the code does use a DAO recordset since I remember successfuly running the code.