Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Edit Excel from VB 1

Status
Not open for further replies.

InsaneProgrammer

Programmer
Jan 17, 2001
44
US
I am writing a program that needs to open an existing excel worksheet, create a chart, and then save the chart to HTML. I am using the Shell() function to open the existing file but how do I access the sheet once its open. I assume I need to create some kind of object. I know how to create a new excel application from VB and do everything I want but I'm not sure how to access an existing worksheet. Any help or ideas would be greatly appreciated.
 
Shell isn't going to do it.
Search "GetObject CreateObject" or "Office Automation". Record macros and view code in Excel to see code that will be needed. If different versions of Excel must be accessed, you may have to use late-binding for production i.e. AS OBJECT instead of AS EXCEL.APPLICATION.
Code:
#Const blnLate = false
#If blnLate then 
    Dim objXL as object
#Else
    Dim objXL as Excel.Application ' Get Intellisense while testing
#End If
Compare Code (Text)
Generate Sort in VB or VBScript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top