Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > ActiveX / Excel help...

Reply
Thread Tools

ActiveX / Excel help...

 
 
firstcustomer@gmail.com
Guest
Posts: n/a
 
      02-21-2006
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:

<!--HTML-->
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
function xlWrite(r,c) {
var xlApp, xlSheet;
xlApp = new ActiveXObject("Excel.Application");
xlApp.Visible = true;
xlApp.Workbooks.Open("C:\\xlText.xls");
xlSheet = xlApp.ActiveSheet;
xlSheet.Cells(r,c).Value = frm.txt.value;
xlSheet.SaveCopyAs("C:\\xlText.xls");
xlApp.Quit();
xlApp = null;
setTimeout("CollectGarbage()",1);
}
// End -->
</script>
</HEAD>

<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
(1,1)">
</FORM>
</HTML>
<!--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.

<!--excel-->

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.DisplayAlerts = False
rowcounter = 2
While Range("a" & rowcounter) <> ""
rowcounter = rowcounter + 1
Wend
Rows("1:1").Copy
Rows(rowcounter).Select
ActiveSheet.Paste

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.

 
Reply With Quote
 
 
 
 
Travis Newbury
Guest
Posts: n/a
 
      02-21-2006
(E-Mail Removed) wrote:
> I want it to work without them being prompted (i.e it just overwrites
> it without asking). Is this possible?


Anything is possible...

 
Reply With Quote
 
 
 
 
firstcustomer@gmail.com
Guest
Posts: n/a
 
      02-21-2006
Ok Travis, how is it possible?!

 
Reply With Quote
 
Jose
Guest
Posts: n/a
 
      02-21-2006
> 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?


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

Jose
--
Money: what you need when you run out of brains.
for Email, make the obvious change in the address.
 
Reply With Quote
 
Andy Dingley
Guest
Posts: n/a
 
      02-21-2006
Jose wrote:

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


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.*
groups.

 
Reply With Quote
 
Neil Monk
Guest
Posts: n/a
 
      02-21-2006

"Jose" <(E-Mail Removed)> wrote in message
news:NWEKf.1247$(E-Mail Removed) ...
>> 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?

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

<snip>
By very harsh internet filtration software.
--
Neil


 
Reply With Quote
 
Neil Monk
Guest
Posts: n/a
 
      02-21-2006

"Neil Monk" <(E-Mail Removed)> wrote in message
news:eHJKf.29827$(E-Mail Removed) k...
>
> "Jose" <(E-Mail Removed)> wrote in message
> news:NWEKf.1247$(E-Mail Removed) ...
>>> 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?

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

> <snip>
> By very harsh internet filtration software.


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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Excel reports ::::Excel 2003 Migration To Excel 2007 =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?= ASP .Net 15 10-24-2007 01:34 PM
ActiveX control in python vs ActiveX control in vb 6 (piece of code) vml Python 0 08-22-2007 09:57 AM
ActiveX apologetic Larry Seltzer... "Sun paid for malicious ActiveX code, and Firefox is bad, bad bad baad. please use ActiveX, it's secure and nice!" (ok, the last part is irony on my part) fernando.cassia@gmail.com Java 0 04-16-2005 10:05 PM
grant IIS permission to create excel activex object Steve Richter ASP .Net 6 04-14-2005 01:23 PM
Re: VB.NET/Excel Automation Issue-Cannot create ActiveX component. George ASP .Net 0 06-25-2004 08:14 PM



Advertisments