Need help displaying Excel sheet with VB5 - Please. 
Author Message
 Need help displaying Excel sheet with VB5 - Please.

I am writing a VB5 application that will simply insert data into a Excel
spreadsheet.  

My problem is that once I have completed filling it with data, I would like
my app to exit and somehow display the filled sheet.  I know how to define
an Excel object in my code and insert the data, but I think that the Excel
object will terminate when my code terminates.  

I would prefer not to save the sheet using the object and then use
something like AppActivate to open the saved sheet before exiting my
program, and I cannot write an 'import' module in VBA.  (Not because I
don't know how :-) )

Is there a way to open the .xls file as a separate application, insert my
data, exit my program and leave the newly filled Excel sheet on the screen?
 Is this what DDE is supposed to do?  Is there any place I can go for
further help?

I'm sure that this is a simple question, but this is my first time
programming with Excel.  

Thank you in advance for any assistance

Gene Oshinsky



Mon, 20 Nov 2000 03:00:00 GMT  
 Need help displaying Excel sheet with VB5 - Please.

Hi Gene,

Quote:
> My problem is that once I have completed filling it with data, I would like
> my app to exit and somehow display the filled sheet.  I know how to define
> an Excel object in my code and insert the data, but I think that the Excel
> object will terminate when my code terminates.

Excel will only terminate if you include an oXL.Quit line in your code.  The
following works for me (in the click event of a VB5 form's button):

 Private Sub Command1_Click()

 Dim oXL As Excel.Application
 Dim oWB As Excel.Workbook

 Set oXL = New Excel.Application

 Set oWB = oXL.Workbooks.Add

 With oWB.Worksheets(1)
    .Cells(1, 1) = "Hello World"
 End With

 oXL.Visible = True

 AppActivate oXL.Caption

 Set oWB = Nothing
 Set oXL = Nothing

 End

 End Sub

Note that I have added a reference to the Excel 8.0 object library in
Project, References.

 Regards

 Stephen Bullen
 Microsoft MVP - Excel
 http://www.BMSLtd.co.uk



Mon, 20 Nov 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Need help displaying Excel sheet with VB5 - Please.

2. Need help displaying Excel sheet with VB5 - Please.

3. Please help! Outlook form to excel sheet

4. Somebody please help me to create an Excel Workbook w/sheets from VB4.0

5. Help needed : How to open Excel Sheet

6. Need Help: Excel 5, rename a sheet ?

7. Displaying Excel sheet in VB6 app?

8. Displaying an Excel Spread Sheet in ASP using VB Script

9. Need Excel Automation help, please, please

10. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

11. VB5 - Properties sheet doesn't display???

12. Linking Excel sheets in VB5

 

 
Powered by phpBB® Forum Software