clearing text fields...

drour1

New Member
Joined
Aug 20, 2002
Messages
3
1st. Lets say you have an "html" page with a "clear" button and some text fields on it.

2nd. Lets say the "html" pages text fields are linked to an external Excel spreadsheet where each text field is linked to a corresponding Excel "cell".

What I don't know is...
when you click the clear button on the "html" page, not only will it clear the text fields on the "html" page, but I need it to also clear (or reset) the corresponding Excel "cells" back to empty cells.

..someone, please help me out...
Thank you.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Anne Troy

MrExcel MVP
Joined
Feb 18, 2002
Messages
2,607
Hi, D!

Let's get this answered for you properly, okay? I'll get "that" coder in here for you...the one who did your code.

:)
 

Jack in the UK

Well-known Member
Joined
Feb 16, 2002
Messages
3,215
Hi

If i have this right ..
What I don't know is...
when you click the clear button on the "html" page, not only will it clear the text fields on the "html" page, but I need it to also clear (or reset) the corresponding Excel "cells" back to empty cells.


You need the HTML buton in raw HTML [I have no ideas of HTML i just bastardise silly jokes stuff] but teh HTNL will need to control Excel

No i do not think HTML can communicate with Excel, its not made that way [im welcome to be corrected here] and so no i would say this can not be done

If you get VBA to program Excel; and HTML im sure this MIGHT be possible as could be done in XLM [VB] so these will allow this but my heart says .NET is you answer

Some ideas but few answers .net allows VB and web / on line communications i i guess this would work.

Jack
 

Colo

MrExcel MVP,
Joined
Mar 20, 2002
Messages
1,456
Hi,
I'm 'the one'. :biggrin:
I'll email the code to you. But now I'm a little busy, so give me a few days.

No i do not think HTML can communicate with Excel, its not made that way [im welcome to be corrected here] and so no i would say this can not be done
Hi Jack! How are you? Just as an information.:)
I made the code by VBS(include type) and JavaScript.
Include typeVBS cannot catch Excel Application by 'GetObject Function' for defending the security of PC.
But it can handle Excel Application via 'CreateObject Function'

Regards,
Colo
 

Colo

MrExcel MVP,
Joined
Mar 20, 2002
Messages
1,456
Okay drour1, I'll email the files later, but as an answer of here, I wite the code.

First, paste the following code into your note pad and save as "ClearWs.vbs".
Please note 'Please Change Here To Correct Path' part.
'----------------------------------------------------------------------------------------
<pre>
Sub ClearXlValue(strFind)
'// Variables
Dim appXl, objWd, objWs, strFn, rngFound

'// Please Change Here To Correct Path //////////////////////////////////////////////
strFn = "Q:eek:rdersOrder Form.xls"
'////////////////////////////////////////////////////////////////////////////////////

'// Open Excel File
Set appXl = CreateObject("Excel.Application")
appXl.Visible = False
appXl.Workbooks.Open (strFn)
Set objExcelBook = appXl.ActiveWorkbook

Set objExcelSheet = objExcelBook.Sheets(1)
Set rngFound = objExcelSheet.Range(objExcelSheet.Range("D10"), _
objExcelSheet.Range("D65536").End(-4162)).Find(strFind)
If Not rngFound Is Nothing Then
rngFound.Offset(,-3).resize(,3).ClearContents
Else
MsgBox strFind & "is NOT Found."
End If
objExcelBook.Close True
appXl.Quit
End Sub
</pre>




Second, modify your each Html files as follows.

a.Put this code in <HEAD> to </HEAD> TAG.

<pre>
<SCRIPT LANGUAGE="VBScript" SRC="ClearWs.vbs"></SCRIPT>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub MyBtn_OnClick
'You need to write All values what you want to delete here.
'VBS cannot use array for Outer file
Call ClearXlValue("KP2323")
Call ClearXlValue("1522")
Call ClearXlValue("1523")
MsgBox "All Corresponding Data in Excel are deleted..."
End Sub
-->
</SCRIPT>
</pre>





b.Put following code just before </FORM></BODY> Tags.

<pre>
<INPUT TYPE="RESET" VALUE="Clear" Name="MyBtn">
</pre>
 

Forum statistics

Threads
1,144,768
Messages
5,726,181
Members
422,660
Latest member
mrsteele

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top