生活随笔
收集整理的這篇文章主要介紹了
通过vba代码将word转换为PDF
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
需要傳兩個參數,word路徑和pdf路徑。
代碼可以做成wsf文件,通過C語言或者java調用
<job id
="wtop">
<reference guid
="{
00020905-0000-0000-C000
-000000000046}
" comment="MSWord
2000 tag library
,under HKEY_CLASSES_ROOT\TypeLib\"
/>
<script language
="VBScript">Option Explicit
Dim Home_file
Dim outdoc_file
Home_file
= WScript.Arguments
(0)
outdoc_file
= WScript.Arguments
(1)Dim WordApp
Set WordApp
= CreateObject
("Word.Application")With WordApp.Visible
= False With .Options.CheckSpellingAsYouType
= False .CheckGrammarAsYouType
= False End With.Documents.
Open(Home_file
).Documents
(1).Activate
Dim doc
Set doc
= .ActiveDocument doc.ExportAsFixedFormat outdoc_file
, 17, False, 0, 0, 1, 1, 0, True, True, 0, True, True, Falsedoc.
Close FalseWith .Options.CheckSpellingAsYouType
= True.CheckGrammarAsYouType
= TrueEnd With.Quit
End With
</script
>
</job
>
總結
以上是生活随笔為你收集整理的通过vba代码将word转换为PDF的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。