|
-
January 20th, 2000, 10:01 AM
#1
Working with Excel
Hi,
I would like to open an existing form of Excel and retreive information about it for example how many sheets, how many columns, rows etc..
How can this be done??
Thank-you!!
LED
-
January 20th, 2000, 10:11 AM
#2
Re: Working with Excel
to connect your program to a running instance of Excel use the GetObject function in VB.
Save the return value in an object variable and use Excel's object model to query it for all desired properties of all relevant objects.
-
January 20th, 2000, 10:13 AM
#3
Re: Working with Excel
sample code from MSDN.
Dim appXL As Excel.Application
Set appXL = GetObject(, "Excel.Application")
-
January 20th, 2000, 10:29 AM
#4
Re: Working with Excel
Hello,
I need to know how to open an existing file for example c:\My Documents\abc.xls and if not exists then create it. Then I would like to run over it's sheets and columns and rows and modify / check what I need . Is there a code sample for this or an article in the MSDN disc?/
Thanks
LED
-
January 20th, 2000, 11:08 AM
#5
Re: Working with Excel
to open a file into excel, add a reference to the Excel typelibrary to your VB project and use the following code
Dim x as Excel.Application
Dim wb as Excel.Workbook
set x = CreateObject("Excel.Application")
set wb = x.Workbooks.Open("c:\test.txt")
x.Visible = true
' now to the modifications and queries
wb.Save ' save your modifications
set x = nothing
check out the Excel object model via the object browser in VB (F2)
-
January 23rd, 2000, 05:40 AM
#6
Re: Working with Excel
Hi Lothar,
I need some more "specificness".
1. What is a "workbook" of an Excel application?
2. What does the method "CreateObject" do??
3. What is the Set x = nothing stand for??
4. What is F2 used for in this example?
5. How do I close the Excel application afetr finishing all modifications?
Thank-you again!!
LED
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|