tbakbradley
Board Regular
- Joined
- Sep 24, 2010
- Messages
- 142
Hello all, it's been quite a while since I've been on here and have not worked much VBA in a few years. I have a simple Excel File that consists of things like Customer Name, Address, ID Number etc. Each one of those are in Cells. B1, B2, B3. I have a Powerpoint "Sketch" if you will with some Icons and lines that never change on Slide 1. What changes is the Text on the Powerpoint, based on what is provided on the Spreadsheet. To avoid retyping all that in Powerpoint, I'd like VBA that opens the Canned Powerpoint File and updates the Text where needed. In PowerPoint, I've clicked on a Text Box and went to Arrange/Selection Pane and defined the names: CsutomerName, Address, IDNumber.
Forgive me for not remembering how to post this correctly with the VBA Script on here.
With this code, my TestSketch.PPTX File opened up, but the CustomerName Text Box didn't update with the value in B1 of the Excel File
After that, I realized from some other sites, I needed to add Set the Powerpoint Presentation, but when I add this, I get a Compile Error (Method or data Member not Found). I found another site that said to check the "Microsoft PowerPoint 16.0 Object Library" in VBA Editor under Tools Which I did.
Any help would be helpful.
Forgive me for not remembering how to post this correctly with the VBA Script on here.
With this code, my TestSketch.PPTX File opened up, but the CustomerName Text Box didn't update with the value in B1 of the Excel File
VBA Code:
Sub ExportObjectToPowerPoint()
'Second Try
Dim MyPPT As Object
Dim PPTPres As PowerPoint.Presentation
Set MyPPT = CreateObject("Powerpoint.application")
MyPPT.Visible = True
MyPPT.presentations.Open "\\Path\TestSketch.PPTX"
MyPPT.Slides(1).Shapes("CustomerName").TextFrame.TextRange.Characters = "B1"
End Sub
After that, I realized from some other sites, I needed to add Set the Powerpoint Presentation, but when I add this, I get a Compile Error (Method or data Member not Found). I found another site that said to check the "Microsoft PowerPoint 16.0 Object Library" in VBA Editor under Tools Which I did.
Any help would be helpful.
VBA Code:
Sub ExportObjectToPowerPoint()
'Second Try
Dim MyPPT As Object
Dim PPTPres As PowerPoint.Presentation
Set MyPPT = CreateObject("Powerpoint.application")
Set PPTPres = PowerPoint.Presentation
MyPPT.Visible = True
MyPPT.presentations.Open "\\Path\TestSketch.PPTX"
MyPPT.Slides(1).Shapes("CustomerName").TextFrame.TextRange.Characters = "B1"
End Sub