ConvertDOCtoHTMLPDF("C:\Test1.docx","Pdf")
ConvertDOCtoHTMLPDF(
"C:\Test1.docx",
"html")
Function
ConvertDOCtoHTMLPDF(SrcFile, Format)
Dim
fso, oFile, FilePath, myFile
Set
fso = CreateObject(
"Scripting.FileSystemObject" )
Set
oFile = fso.GetFile(SrcFile)
FilePath = oFile.Path
Dim
oWord
Set
oWord = CreateObject(
"Word.Application" )
oWord.Documents.Open FilePath
If
ucase(Format) =
"PDF" Then
myFile = fso.BuildPath (ofile.ParentFolder ,fso.GetBaseName(ofile) &
".pdf")
oWord.Activedocument.Saveas myfile, 17
elseIf ucase(Format) =
"HTML" Then
myFile = fso.BuildPath (ofile.ParentFolder ,fso.GetBaseName(ofile) &
".html")
oWord.Activedocument.Saveas myfile, 8
End
If
oWord.Quit
Set
oWord = Nothing
Set
fso = Nothing
Set
oFile = Nothing
End
Function
No comments:
Post a Comment