Dim objword
Dim objdoc
Dim objfso
Dim strsource
Dim strtarget
Dim bbatch
'The command line parameter can be obtained in three possible formats: [-S]. The source file directory or file to be converted is converted to the directory saved after HTML file conversion.
Function getparams ()
Dim objarg
If wscript. Arguments. Count> = 2 then
If wscript. Arguments. Item (0) = "-s" or wscript. Arguments. Item (0) = "-s" then
Strsource = wscript. Arguments. Item (1)
Strtarget = wscript. Arguments. Item (2)
Bbatch = false
Else
Strsource = wscript. Arguments. Item (0)
Strtarget = wscript. Arguments. Item (1)
Bbatch = true
End if
Else
Wscript. Quit (1)
End if
End Function
Function batchprocessing ()
Dim objfolder
Dim objfile
Dim LPOS
Dim strfilename
LPOS = 0
Set objfolder = objfso. getfolder (strsource)
For each objfile in objfolder. Files
LPOS = instr (1, mid (objfile. Path, Len (objfile. Path)-3, 4), "Doc", 1)
If LPOS> 0 then
Strfilename = objfso. getbasename (objfile. Path)
Wordinterface objfile. Path, strfilename
End if
Next
End Function
Function singleprocessing ()
Dim objfile
Set objfile = objfso. GetFile (strsource)
Strfilename = objfso. getbasename (objfile. Path)
Wordinterface objfile. Path, strfilename
End Function
Function wordinterface (strfilename, formattedfilename)
Objword. Documents. Open strfilename
Set objdoc = objword. activedocument
'Stop
'Set the title of the document to match the filename
Objdoc. builtindocumentproperties (1) = formattedfilename
'1 = wdpropertytitle in VBA
Objdoc. saveas strtarget & "/" & formattedfilename & ". htm", 8
'Objdoc. saveas "C:/doc2html/" & formattedfilename & ". htm", 8
On Error resume next
Objdoc. Close
End Function
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.