ActiveX组件无法创建对象VBA

时间:2017-07-12 14:55:44

标签: excel-vba powerpoint vba excel

我将PPT转换为PDF时出现错误,因为“ActiveX组件无法创建对象VBA”

    Dim PPT As PowerPoint.Application
    Dim newslide As PowerPoint.SlideRange
    Dim slideCtr As Integer
    Dim tb As PowerPoint.Shape
    Set PPT = CreateObject("PowerPoint.Application")
    PPT.Visible = True
    PPT.Presentations.Open"C:\Users\GShaikh\Desktop\ProcessCoach certificate template.pptx"
    Range("F8").Activate  'This cell had a date formatted as a date
    slideCtr = 1

    Set tb = PPT.ActivePresentation.Slides(slideCtr).Shapes("Text Box 4")
    tb.TextFrame.TextRange.Characters.Text = Format(ActiveCell.Value, "m/d/yyyy")

    'Error is here
    ActivePresentation.ExportAsFixedFormat ActivePresentation.Path & _
 "\" & ActivePresentation.Name & _
 ".pdf", ppFixedFormatTypePDF, ppFixedFormatIntentPrint

0 个答案:

没有答案