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!

Opening an excel file in current excel session 1

Status
Not open for further replies.

nevets2001uk

IS-IT--Management
Jun 26, 2002
609
GB
I'm trying to create a web page with a normal link which will load an excel file.

The first thing I want to achieve is to load the file when the user clicks a link. I'd rather use this than have to place a button on the screen. I've thought of a bodgy way of achieving the effect but there must be a simple way to add a sub event for a link or something!

Also is it possible to check for current running versions of excel before opening a new session. So if there is an excel session running the code should simply load the excel file into that session but if excel is not running then it should open it first and the load the file.

Finally can you open the file as read only so that the intranet users accessing it can just view it but not save their changes?

I'd assume VBScript can do all the above but I'm no expert.

Steve
 
To create an excel file use this code:
set obexcel=GetObject(,"Excel.Application")
if err.number<>0 then
set obexcel=CreateObject(&quot;Excel.Application&quot;)
end if

obexcel.workbooks.add
set obworkbooks=obexcel.ActiveSheet
Behnam2204@yahoo.com
BehnamPro
 
I've tried the code above but I'm getting an error &quot;Active X Component can't create object: 'GetObject'

Any ideas on this?
 
So add &quot;On Error Resume Next&quot; first the code,Because in this code if an excel application is running then an error would occure,then in the next line in code prosses the error and would find that excel application is not running,so runs excel.

Excuse me if mistakes in dictation or grammar!
Behnam2204@yahoo.com
BehnamPro
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top