|
-
April 14th, 2001, 06:18 PM
#1
Excel
Is there a way to open up an Excel file within the excel application itself from VB.
I would like to open a file (ie. Parts List.xls) from VB, but I want it to be in the Excel application, seperate from the VB app.
Thanks - Ron Gregoire
I hope I'm explaining it clearly.
-
April 23rd, 2001, 07:09 PM
#2
Re: Excel
Is this something you want to shell or something to which you would like to retain control?
Here are a few samples:
' Demonstrate four different methods of opening an Excel file
' The last three methods are similar in that they retain control of the application
' The first method shells the operation, thereby relinquishing control
public Sub OpenExcelFile()
Dim sFilename as string
Dim sShell as string
Dim dTask as Double
' Existing sample Workbook
sFilename = "C:\Data\Excel\TestWorkbook.xls"
' Utilizes Shell
sShell = Excel.Application.Path & "\" & "Excel.exe " & sFilename
dTask = Shell(sShell, vbNormalFocus)
' Utilizes Workbook object
Dim wkb as Workbook
set wkb = Excel.Workbooks.Open(sFilename)
wkb.Application.Visible = true
MsgBox "wkb Application Open"
wkb.Close
set wkb = nothing
' Utilizes CreateObject
Dim xl as Object
set xl = CreateObject("Excel.Sheet")
xl.Application.Workbooks.Open sFilename
xl.Application.Visible = true
MsgBox "xl Application Open"
set xl = nothing
' Utilizes Excel
Excel.Workbooks.Open sFilename
Excel.Application.Visible = true
MsgBox "Excel Application Open"
Call Excel.Workbooks.Close
End Sub
-
April 24th, 2001, 11:15 PM
#3
Re: Excel
Utilizing WorkBook Method worked the best.
Just wanted to say thanks for the help.
-
February 21st, 2002, 01:21 AM
#4
Re: Excel
can i know soding to open excel file?
-
February 21st, 2002, 01:46 AM
#5
Re: Excel
what is the function of shell acctually....
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
|