Ask Question Forum:
C
O
M
P
U
T
E
R
2
8
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Y-position of the mouse cursor
Attachment:===
How to Insert javescript code into htm file by VBA

at the location below <script language="JavaScript"> in the Example.htm file by VBA automatically
every day. Why I need this operation because the table data in htm file will be updated or overwritten by new one daily and also need additional Javascript coding for complete additional operation in my own website home page. In other words, it is just adding the following example
a piece of Javascript code into Example.htm. Could you provide me some VBA code to start
the coding. Please advise what is good method in VBA to do that ? Could you aslo provide
search text string in file function to locate <script> tag area ?
Please advise
Duncan
Example Small javascript code will be added into Example.htm file
-----------------------------------------------------------------------------------
var g_iSh = 0;
if (window.location.search)
g_iSh = window.location.search.split(/=/)[1];
window.setInterval("refreshPage()", 10000); //refresh every 10 sec
==================================================
Example.html file here and wish to add the example of Javascript code inside
==========================================================
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta name="Excel Workbook Frameset">
<meta http-equiv=Content-Type content="text/html; charset=big5">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 11">
<link rel=File-List href="junk3.files/filelist.xml">
<link rel=Edit-Time-Data href="junk3.files/editdata.mso">
<link rel=OLE-Object-Data href="junk3.files/oledata.mso">
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Author>kkw</o:Author>
<o:LastAuthor>kkw</o:LastAuthor>
<o:Created>2010-10-27T13:41:34Z</o:Created>
<o:LastSaved>2010-10-27T14:44:02Z</o:LastSaved>
<o:Version>11.9999</o:Version>
</o:DocumentProperties>
</xml><![endif]--><![if !supportTabStrip]>
<link id="shLink" href="junk3.files/sheet001.htm">
<link id="shLink" href="junk3.files/sheet002.htm">
<link id="shLink" href="junk3.files/sheet003.htm">
<link id="shLink">
<script language="JavaScript">
**************Wish and want to add some javascript code here by VBA automatically ************** around area below script tab
.................
<! other orginal html code
</html>
Tnanks for your reply.
Finally I solved this out and
html is generated by savas function
in VBA and replace() to replace
to insert the code into html
Duncan
Tnanks for your reply.
Finally I solved this out and
html is generated by savas function
in VBA and replace() to replace
to insert the code into html
Duncan
Tnanks for your reply.
Finally I solved this out and
html is generated by savas function
in VBA and replace() to replace
to insert the code into html
Duncan