Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / October 2004

Tip: Looking for answers? Try searching our database.

Help killing Excel

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
;-\) - 01 Oct 2004 05:16 GMT
This code works for ~20 sets of excel workbooks.  ONE of the sets (a single
workbook) always crashes the workbook, with a request to contact MS with the
error report.  The last crash gave me a DDE server crash error.

Is there any thing in the sheet that would cause this?

For i = 1 To rsMaster.RecordCount
    'Set xl(i) = New Excel.Application             'Early binding
    Set xl(i) = CreateObject("Excel.Application")  'Late  Binding
    With xl(i)
        If admin Then                              'hide from user?
            .Visible = True
        Else
            .Visible = False
        End If
        .Application.WindowState = xlMinimized
        .Application.DisplayAlerts = False
        .Workbooks.Open FileName:=(pathExcel & rsMaster!Source),
UpdateLinks:=0, ReadOnly:=False
    End With
    rsMaster.MoveNext
Next i

'...much work done

Set rsLbl = xl(i).Application.Run("getRs", rsLbl)   'call Excel Function

'...much work done

'now end
For Each x In xl()
    x.ActiveWorkbook.Saved = True
    x.Quit
    Set x = Nothing
Next
Bernie Deitrick - 04 Oct 2004 14:12 GMT
James,

Perhaps your applicaiton would be more stable if you only used one instance
of Excel rather than an array of Excel applications. You can still do
everything you are doing, just without having multiple Excel instances in
use.

HTH,
Bernie
MS Excel MVP

> This code works for ~20 sets of excel workbooks.  ONE of the sets (a single
> workbook) always crashes the workbook, with a request to contact MS with the
[quoted text clipped - 31 lines]
>      Set x = Nothing
>  Next
;-\) - 06 Oct 2004 02:16 GMT
Possible.

The sheets are supplied by the client's Engineering Dept.  Each set does one
product line.

One of the first and largest sets of sheets (5) has never given a problem.

The lines that do give problems this way only have one or 2 open sheets.

The excel function I call is duplicated in each workbook, so I would have to
rewrite my code to qualify the function.  Also the main app is done and has
been in the field for almost 3 years, so I really don't want to do a VB
rewrite.

Since an error in closing does not cause my calling VB program to die, and I
was finished with the Excel set anyway I have never put it high on my list
of things to fix.

BUT my app moved from one plant to three.  It just gives my stuff an
unprofessional appearance.

It is also the type of problem that I will never be able to get out of my
mind.  There just must be something in those Excel sheets that fail that can
be changed to make them work with the standard VB calling code.

> James,
>
[quoted text clipped - 45 lines]
>>      Set x = Nothing
>>  Next
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.