Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default strange run time error

i have a vb6 program that runs great from teh ide but errors with
application has disconnected from objects when i run it standalone.

I was pointed in this direction so im hoping someone can help me resolve
this please.

The code dealing with excel:
__________________________________________________ _________



Dim exlApp As Excel.Application
Dim exlBook As Excel.Workbook
Dim exlSheet As Excel.Worksheet

'----------------------------------------------------------------
' Get Excel if it's running
Set exlApp = GetObject(, "Excel.Application")
If Err < 0 Then
'Excel wasn't running, start it from code
Set exlApp = CreateObject("Excel.Application")
End If

' remove old file, create new spreadsheet from existing
Kill App.Path & "\" & newDocName & ".xls"
Set exlBook = exlApp.Workbooks.Open(App.Path & "\" &
"ProtoLetters.xls", False, True)

exlBook.SaveAs FileName:=App.Path & "\" & newDocName & ".xls"

Set exlSheet = exlBook.Worksheets("Sheet1")

dblCount = dblCount + 1

With exlSheet

.Activate

.Cells(dblCount, 1) = "Value 1"
.Cells(dblCount, 2) = "Value 2"
.Cells(dblCount, 3) = "Value 3"
.Cells(dblCount, 4) = "Value 4"
.Cells(dblCount, 5) = "Value 5"

If dblCount = 1 then
.Cells(dblCount, 6) = "N/A"
.Cells(dblCount, 7) = "N/A"
End If

End With


' finish spread sheet and end excel
' borders for data cells

With exlSheet
.Activate

.Range(.Cells(2, 1), .Cells(dblCount, 15)).Borders.LineStyle =
xlContinuous
.Range(.Cells(2, 1), .Cells(dblCount, 15)).Borders.ColorIndex = 1
.Range(.Cells(2, 1), .Cells(dblCount, 15)).Borders.Weight = xlThin

.Range(.Cells(1, 1), .Cells(dblCount, 15)).Columns.AutoFit

.PageSetup.LeftHeader = "Printed on &D"
.PageSetup.CenterHeader = "&B Applicants"
.PageSetup.RightHeader = "Scheduled"

.PageSetup.LeftFooter = "Page &P of &N"
.PageSetup.CenterFooter = "&B &I My Company"
.PageSetup.RightFooter = "&B Company Confidential Information"

.PageSetup.Orientation = xlLandscape

End With

' save spreadsheet, close it, end Excel
exlApp.ActiveWorkbook.Save
exlApp.ActiveWorkbook.Close
exlApp.Quit
__________________________________________________ _________

Thanks in advance for your time and consideration

sincerely

Woody
I am not responsible for anything you may see with my name attached to
it, i think.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
strange error martinbarnes Excel Discussion (Misc queries) 3 April 1st 08 09:02 PM
Strange Excel error D23 Excel Discussion (Misc queries) 3 August 17th 07 09:01 PM
strange error AD108 Excel Worksheet Functions 7 August 9th 06 09:22 AM
Strange error Andy Setting up and Configuration of Excel 1 April 18th 06 08:11 PM
Very strange error superkopite Excel Discussion (Misc queries) 3 February 19th 06 11:21 AM


All times are GMT +1. The time now is 10:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"