Excel Hangs when saving worksheet from .dll

Hi Experts.
Here's one thats got me stumped.

I have created a .dll that contains a class that opens, saves, closes excel. The code works on all my other machines except the server i need it to run on. The Server is 2003 all the other machines are XP Pro/WinNT 2K. When the program is executed, it never returns an error other than:

>> Faulting application wscript.exe, version, faulting module unknown, version, fault address 0x00000000.

Here is how this is setup.

I have 2 vbs scripts. 1 runs a copy of the code that is in the dll (it works), the other references the .dll and calls the Open Save Close Functions in the .dll (This one hangs on the Save Function.)

'Code for Script 1:
msgbox "Opening Excel"
Dim oExcelApp
Set oExcelApp = CreateObject("EXCEL.APPLICATION")
oExcelApp.Visible = False
oExcelApp.AlertBeforeOverwriting = False
oExcelApp.DisplayAlerts = False
msgbox "adding workbook"
Set oWs = oExcelApp.ActiveSheet
Set oWb = oExcelApp.ActiveWorkbook
msgbox "Editing Worksheet"
With oWs
    .Range("A:A").ColumnWidth = 10.86
    .Range("B:B").ColumnWidth = 18.14
    .Range("C:C").ColumnWidth = 8.43
    .Range("D:D").ColumnWidth = 9.43
    .Range("E:E").ColumnWidth = 8.57
    .Range("F:F").ColumnWidth = 8.57
    .Range("G:G").ColumnWidth = 9.43
'    .Range("H:H").ColumnWidth = 10.43
'    .Range("I:I").ColumnWidth = 10.43
'    .Range("J:J").ColumnWidth = 13.43
    .Name = "Sheet 1"
    .Cells(1, 1).Value = "'Coname " 
    .Cells(2, 1).Value = "'SSN"
    .Cells(2, 2).Value = "'NAME"
    .Cells(2, 3).Value = "'TYPE"
'    .Cells(2, 4).Value = "'STUDENTS_NAME"
'    .Cells(2, 5).Value = "'STUDENT_SSN"
'    .Cells(2, 6).Value = "'DISB_NO"
    .Cells(2, 4).Value = "'DISB_AMT"
    .Cells(2, 5).Value = "'GNTE_FEE"
    .Cells(2, 6).Value = "'ORIG_FEE"
    .Cells(2, 7).Value = "'NET_AMT"
End With
msgbox "saving xls"
 ows.saveas "c:\test.xls"
msgbox "Done"

Sub CloseExcel()
    ' Terminate and release the Excel objects.

End Sub

'Code for Script 2
Dim otm
set otm = createobject("trafficmonitor.clsExcel")
msgbox "opening Excel"
msgbox "Saving Excel Workbook"
otm.saveexcel "c:\test.xls" <---------{HANGS HERE}
msgbox "Closing Excel"
msgbox "Done"

once the application is hung. I have to go into task manager and end excel. THe code in Script 1 is the same code as in the .dll {clsExcel}

Good Luck....
I hope you can Help
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Leo EikelmanDirector, IT and Business DevelopmentCommented:
try saving it to a sub folder on the c:\ driver rather then on the root

see if that works,

Leo EikelmanDirector, IT and Business DevelopmentCommented:
Also, have you tried increasing the Request timeout on the server to see if it is still processing or if it just simply crashed and not exiting?

there was also some issue I dug up with saving excel sheets with IncludeHeaders set.  I don't know if u are using this functionality or not.

Also, doing a bit more reading I found that this may infact be a bug.

Make sure you have the latest versions installed.



wraith821Author Commented:
This is a vb application not a web app. there are no includes and it running under an account with administrative rights.
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Leo EikelmanDirector, IT and Business DevelopmentCommented:
Are you just saving one worksheet?

cause maybe you can try using the SaveGrid method.

Through reading I found there are lots of bugs people found in the SaveExcel method.

good luck,


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wraith821Author Commented:
That didn't work. something is preventing Excel from saving at all.
wraith821Author Commented:
run from the .dll that is.
wraith821Author Commented:
Well, for all you people wondering... It was my installation of VB6. when the .dll was compiled on my new machine with a new install of vb6, it just didn't work. i have since found other quirks with other compiled exe's and .dlls compiled on this new machine. I recompiled the .dll on my old machine where it was originally created and it works just fine. So.. even though you didn't help me, i'm going to give leikelman all 500 points just because he tried when noone else would.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.