2Angel
asked on
Edit HTML file using Visual Basic 6
Hi,
I have a MsWord document which I run a VB code to save it as HTML file.
I would like to add to it this code:
<script language = "javascript">
document.onmousedown=disab leclick
function disablecklick(e) {
if( event.button==2 )
alert("Sorry");
return false;
}
</script>
Pls help.
Tks
I have a MsWord document which I run a VB code to save it as HTML file.
I would like to add to it this code:
<script language = "javascript">
document.onmousedown=disab
function disablecklick(e) {
if( event.button==2 )
alert("Sorry");
return false;
}
</script>
Pls help.
Tks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can do something like this to rename the file :
Set fileSpec = fso.GetFile(fileName) '<-- filename must include the path of the file as well as the file(s) name
fileSpec.Name = "File_Name.html"
So if your file was located on the C drive then it would be as follows :
Set fileSpec = fso.GetFile(C:\File_Name.t xt) '<-- filename must include the path of the file as well as the file(s) name
fileSpec.Name = "File_Name.html"
If that does not work then you could use the move file to basically delete the text file and rename it as html, hence creating the html file for you without leaving text files :)
Here is a url showing you how to use MoveFile :
http://www.sloppycode.net/Reference/FSO/Ref-93.html
Set fileSpec = fso.GetFile(fileName) '<-- filename must include the path of the file as well as the file(s) name
fileSpec.Name = "File_Name.html"
So if your file was located on the C drive then it would be as follows :
Set fileSpec = fso.GetFile(C:\File_Name.t
fileSpec.Name = "File_Name.html"
If that does not work then you could use the move file to basically delete the text file and rename it as html, hence creating the html file for you without leaving text files :)
Here is a url showing you how to use MoveFile :
http://www.sloppycode.net/Reference/FSO/Ref-93.html
I forgot to mention one thing, make sure you have a refernce to the Microsoft Scripting Runtime by going to Project --> References and checking the box next to it :) before you run it :)
Not sure if you knew this or not ?
Not sure if you knew this or not ?
ASKER
Thanks man!
Your welcome ! Thanks for the points and grade ! I hope this helped you out ! You got it working now ?
Not sure if this is what you are looking for ?
You may also need to add the other html lines ie
<HTML>
<BODY>
'with your script in here :)
</BODY>
</HTML>
Take a look here for using the FSO :
http://juicystudio.com/tutorial/vb/files.asp