| | |
opening excel file in visual basic 6
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Aug 2007
Posts: 47
Reputation:
Solved Threads: 0
I try to open excel file in visual basic 6. Somebody gave me this code to open excel file. But when i create a my new form and type this code. An error occured for this code
Private Sub Form_Load()
Dim x_app As Excel.Application
Dim x_wbk As Excel.Workbook
Dim x_wsh As Excel.Worksheet
Set x_app = New Excel.Application
Set x_wbk = x_app.Workbooks.Add
Set x_wsh = x_wbk.Worksheets.Add
x_wsh.Cells(1, 1) = 50
x_app.Visible = True
End Sub
When I declare
Dim x_app as Excel.Application in my new form it is not accepted It change to Dim x_app as Excelfrm.
How to add Excel in my object browser. Maybe it is the solution to open my excel file in visual basic 6.
Anybody can help me and I appreaciate it alot. Step by step instruction to clearly open excel file in vb6 is served me best.
Thank you in advance.
Private Sub Form_Load()
Dim x_app As Excel.Application
Dim x_wbk As Excel.Workbook
Dim x_wsh As Excel.Worksheet
Set x_app = New Excel.Application
Set x_wbk = x_app.Workbooks.Add
Set x_wsh = x_wbk.Worksheets.Add
x_wsh.Cells(1, 1) = 50
x_app.Visible = True
End Sub
When I declare
Dim x_app as Excel.Application in my new form it is not accepted It change to Dim x_app as Excelfrm.
How to add Excel in my object browser. Maybe it is the solution to open my excel file in visual basic 6.
Anybody can help me and I appreaciate it alot. Step by step instruction to clearly open excel file in vb6 is served me best.
Thank you in advance.
Last edited by locsin; Sep 9th, 2007 at 3:53 am.
Hi,
Use this code:
Use this code:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub Command1_Click() Dim xl As Object Dim xlwbook As Object Dim xlsheet As Object Set xl = CreateObject("Excel.Application") Set xlwbook = xl.Workbooks.Add Set xlsheet = xlwbook.Worksheets.Add 'do your staff example: xlsheet.range("A1") = 100 'finish you staff xl.Quit Set xl = Nothing Set xlwbook = Nothing End Sub
It is never about the number of languages you know, you either have the logic of programming or you don't ...
Some of the codes I post are collected from different sites during the past couple of years, so I would like to thank them for their help and for enabling me to help.
Some of the codes I post are collected from different sites during the past couple of years, so I would like to thank them for their help and for enabling me to help.
Hi,
If you want to save you work just before xl.quit add:
If you want to save you work just before xl.quit add:
xlwbook.saveas "c:\x.xls" It is never about the number of languages you know, you either have the logic of programming or you don't ...
Some of the codes I post are collected from different sites during the past couple of years, so I would like to thank them for their help and for enabling me to help.
Some of the codes I post are collected from different sites during the past couple of years, so I would like to thank them for their help and for enabling me to help.
![]() |
Similar Threads
- Open Excel file from Visual Basic (Visual Basic 4 / 5 / 6)
- getting data from a text file and putting it in an excel file using visual basic 6.0 (Visual Basic 4 / 5 / 6)
- open a PDF file in visual basic (Visual Basic 4 / 5 / 6)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: how to transparent the background of the image on PDA/Mobile Simulator (VB)
- Next Thread: Referencing a picture in Word 97
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





