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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Starting Excel

Status
Not open for further replies.

Neily

Programmer
Jul 27, 2000
342
GB
I have a web site that I require to start excel read cell values and then close excel again. Can someone help me to do this. Thanks
 
Hi

You have to decide whether you want this to run server side or on the client side.

What are you looking to get out of excel?

Tim
 
There are two ways of doing this depending on how your spreadsheet is setup. You can either connect to it like a database and pull records (rows), or you can create an instance of the Excel app and just pull the values directly.

I'll show you how to do it the second way.

Dim objExcel, filename, path, outputvar1, outputvar2
path = "c:\temp\"
filename = "test.xls"
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Open path & filename
objExcel.WorkBooks(filename).Activate
With objExcel.ActiveWorkbook.Worksheets("Sheet1")
outputvar1 = .Range("A1").Value
outputvar2 = .Range("B5").Value
End With
objExcel.Quit 2
MsgBox outputvar1 - outputvar2

For future reference, you can goto the Help file in Excel, then choose the Programming Information section to get a listing of all objects/methods/properties etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top