Blogtrottr
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中 
請教vba高手,ppt轉pdf
Feb 4th 2015, 15:08

office 2013....請教vba高手.....
問題1)下方哪邊可再做簡化修正?
問題2)在D:\E\A下只有一份PPT,若遇XX月A月報01.ppt就會出現錯誤,要如何修正?
問題3)最下方Call ppt2pdf..好像不能一次轉檔,要如何修正?
直接引用PowerPoint Library內建的另存PDF功能,設定引用項目→「Microsoft PowerPoint 15.0 Object Library」
---------------------------------------------
Private Sub ppt2pdf(ByVal pptFilePath As String, ByVal pdfFilePath As String)
Dim pptApp As New PowerPoint.Application
Dim pptPre As PowerPoint.Presentation

Set pptPre = pptApp.Presentations.Open(pptFilePath, msoFalse, , msoFalse)
pptPre.ExportAsFixedFormat pdfFilePath, ppFixedFormatTypePDF
pptPre.Close
pptApp.Quit
End Sub
----------------------------------------------
Public Sub AA()
Dim FSO As Object
Dim S, xyz1, xyz2 As String

Set FSO = CreateObject("Scripting.FileSystemObject")
S = "D:\E"
If Dir(S, vbDirectory) = "" Then
MkDir (S)
End If

On Error Resume Next
xyz1 = InputBox("請輸入年度yyy:")
xyz2 = InputBox("請輸入月份mm:")
'複製整個目錄
Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.CopyFolder "Y:\資料\A\" & xyz1 & "年度月報\" & xyz2 & "月", "D:\E\A", True
FSO.CopyFolder "Y:\資料\B\" & xyz1 & "年度月報\" & xyz2 & "月", "D:\E\B", True
FSO.CopyFolder "Y:\資料\C\" & xyz1 & "年度月報\" & xyz2 & "月", "D:\E\C", True

Set FSO = Nothing
Call ppt2pdf("d:\E\A\" & xyz2 & "月A月報.ppt", "d:\E\A\" & xyz2 & "月A月報.pdf")
Call ppt2pdf("d:\E\B\" & xyz2 & "月B月報.ppt", "d:\E\B\" & xyz2 & "月B月報.pdf")
Call ppt2pdf("d:\E\C\" & xyz2 & "月C月報.ppt", "d:\E\C\" & xyz2 & "月C月報.pdf")
End Sub

Recommended article: Chomsky: We Are All – Fill in the Blank.
This entry passed through the Full-Text RSS service - if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions
arrow
arrow
    全站熱搜

    kkoovoztxwbqy 發表在 痞客邦 留言(0) 人氣()