[AccessD] Problem with Access VBA makes Excel Orphan

Shamil Salakhetdinov shamil at smsconsulting.spb.ru
Fri Nov 13 17:31:30 CST 2009


Hi Edward --

<<<
  .HPageBreaks.Add Before:=Cells(lRow + 1, 6)
>>>
The above code line will create a ghost instance of MS Excel.

The following currently commented code line
<<<
'    .SelectedSheets.HPageBreaks.Add Before:=ActiveCell
>>>
will also force a ghost Excel application to be created if you uncomment
it...

HTH.

--
Shamil


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Edward Zuris
Sent: Saturday, November 14, 2009 1:39 AM
To: accessd at databaseadvisors.com
Cc: Lambert.Heenan at chartisinsurance.com
Subject: Re: [AccessD] Problem with Access VBA makes Excel Orphan


 Thanks Heenan Lambert,

 I'll see if I can come up with something
 a smaller that demonstrates the problem.

 I was hopeing there was a command that forces 
 Excel to finish-up whatever and exit cleanly
 regardless.

 Killing the Excel orphan isn't an option because
 the Access 2000 VBA still thinks it is out there
 causing other downstream Excel jobs to fail.

 The problem started when I started forcing
 Page Control Breaks whenever the Department
 column had a change.

 = = = = = = = = = = = = = = = = = = = = = = =

    If sNew <> sOld Then
       sTmp5 = ""
       sTmp5 = CStr(lRow + 1) & ":" & CStr(lRow + 1)
       ExcelwBook.sheets(sSheet).Rows(sTmp5).Insert Shift:=-4121
       For lColumn = 1 To 6
           ExcelwBook.sheets(sSheet).Cells(lRow + 1,
lColumn).Interior.ColorIndex = 10
       Next lColumn

       sOld = ""
       sOld = sNew

        If lRow > 1 Then
           '                        * First Method *
           'On Error Resume Next
           'ExcelwBook.sheets(sSheet).Cells(lRow + 1, 6).Select
           ' With ExcelwBook.Application.ActiveWindow
           '    .ScrollColumn = 2
           '    .SelectedSheets.HPageBreaks.Add Before:=ActiveCell
           'End With
           'On Error GoTo 0

            ' *****************************************************
            ' Force Page Control Breaks
            '
            With ExcelwBook.sheets(sSheet)
                .HPageBreaks.Add Before:=Cells(lRow + 1, 6)
            End With

        End If

    End If

 = = = = = = = = = = = = = = = = = = = = = = =
 = = = = = = = = = = = = = = = = = = = = = = =

<<< snip >>>
 

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 4605 (20091113) __________

The message was checked by ESET NOD32 Antivirus.

http://www.esetnod32.ru
 




More information about the AccessD mailing list