ActiveX / Excel help...

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi fellas, another request for help I'm afraid!

I've got a HTML page that has a form. When submitted, the form writes
to an Excel file. The problem is that the user is told that the file
already exists, do they want to overwrite it?

I want it to work without them being prompted (i.e it just overwrites
it without asking). Is this possible?

The HTML/ActiveX code and the Excel code is below:


<!-- Begin
function xlWrite(r,c) {
  var xlApp, xlSheet;
  xlApp = new ActiveXObject("Excel.Application");
  xlApp.Visible = true;
  xlSheet = xlApp.ActiveSheet;
  xlSheet.Cells(r,c).Value = frm.txt.value;
  xlApp = null;
//  End -->

<FORM NAME="frm">
  <INPUT TYPE="Text" NAME="txt" Value="Some cell text"><BR>
  <INPUT TYPE="Button" VALUE="Put in row 1, column 2" ONCLICK="xlWrite
<!--end HTML-->

Yes, I know it isn't "valid" HTML, but it works fine other than this
problem that isn't caused by the lack of body tags etc.


Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.DisplayAlerts = False
rowcounter = 2
While Range("a" & rowcounter) <> ""
rowcounter = rowcounter + 1

End Sub

<!--end excel-->

Basically, the HTML form writes to a specified cell (A1 in this
example) and then closes Excel. before closing, Excel copies what is in
the top row, to the next empty row, if you get my meaning...

How can I stop it prompting whether to overwrite or not?

TIA, Neil.

Re: ActiveX / Excel help... wrote:
Quoted text here. Click to load it

Anything is possible...

Re: ActiveX / Excel help...

Ok Travis, how is it possible?! :-)

Re: ActiveX / Excel help...

Quoted text here. Click to load it

Given a solution, how is the user protected against a similar, hostile
web page that overwrites his own excel spreadsheets?

Money:  what you need when you run out of brains.
for Email, make the obvious change in the address.

Re: ActiveX / Excel help...

Jose wrote:

Quoted text here. Click to load it

By the sandbox model. What an ActiveX is allowed to get up to depends
on from where you obtained the page. With crazyily insecure configs
this could be a problem, but the defaults are generally fairly safe.

This type of question though is really an Excel / COM / VBA question.
You'll find more relevant eyeballs over in one of the microsoft.*

Re: ActiveX / Excel help...

Quoted text here. Click to load it
By very harsh internet filtration software. :-)

Re: ActiveX / Excel help...

Quoted text here. Click to load it

I'm the OP btw, I'm just at home now!

Site Timeline