Jump to content

PowerPoint Help - (Moved)


Recommended Posts

Hello anyone who is willing to help guide me. I'm having trouble with the PowerPoint UDF. I can't even seem to get PowerPoint to open using it. I've dropped the PowerPoint.au3 file into the Include folder, but running any of the commands after that seem to produce nothing. I've been successful with the Excel one, so I'm not sure what is going wrong. Can someone give me a simple example script for something like this to learn from:

 

1) Open C:/folder/test1.pptx

2) Save as C:/folder/test2.pptx

3) Close the PowerPoint

 

I would really appreciate your guidance

Link to comment
Share on other sites

Can you please post the script you are using?
Do you check for errors after each powerpoint funtion call?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

OK, so I'm trying to start real simple with this. I've put the Powerpoint.au3 in the #include folder, and I presume I have to have my script in the same folder as the _PPT files.

I then copy the _PPT_PresentationOpen example and try to change it a little to verify it is working, but I get an error of "Error creating the PowerPoint application object @error =1, @extended = 2147221164":

 

#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=N
#include <PowerPoint.au3>
#include <MsgBoxConstants.au3>
; *************************
; Create application object
; *************************
Global $oPPT = _PPT_Open()
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_PresentationOpen Example", "Error creating the PowerPoint application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

; **************************************
; Open an existing presentation readonly
;***************************************
Global $sPresentation = ("C:\Folder\Test1.pptx")
Global $oPresentation = _PPT_PresentationOpen($oPPT, $sPresentation, True)
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_PresentationOpen Example", "Error opening presentation '" & $sPresentation & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
MsgBox($MB_ICONINFORMATION, "PowerPoint UDF: _PPT_PresentationOpen Example 1", "Presentation '" & $sPresentation & "' successfully opened readonly.")

Link to comment
Share on other sites

It's been years since I used AutoIT, and I'm just starting to get back into again, so please be kind if I'm being incredibly dense.

Also, the script refers to opening in 'read only', is there a way of opening it without being read only? Otherwise I presume I will not be able to move on and then save it after a minor change 😒

Link to comment
Share on other sites

To open a presentation in read/write you have to modify the _PPT_PresentationOpen statement. Please check the help file.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

2 hours ago, SkysLastChance said:
  • Which version of Power Point? 32/64 bit?
  • Which operating system? 32/64 bit?
  • Which version of AutoIt?

Powerpoint 32bit, Windows 10 64bit and latest version of AutoIT

Edited by boltonebob
Link to comment
Share on other sites

1 hour ago, water said:

To open a presentation in read/write you have to modify the _PPT_PresentationOpen statement. Please check the help file.

Yeah, that is where this gets embarrassing 😳. I have been reading the help files and looking at the examples. I've been using the built in Excel functionality fine, but something is really escaping me here on the PowerPoint one. I could find lots of examples of the Excel one, even on YouTube, but I find very little info on the PowerPoint UDF. I seem to be missing something between the two. I'll keep searching and hopefully soon I'll work it out.

Link to comment
Share on other sites

The latest PowerPoint UDF comes with a CHM help file.

image.thumb.png.900c981be5dda257a1cf4a473b0073a1.png

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

OK I have a lot more clarity on why nothing I was trying was working. It all seems to center back on even opening Powerpoint. For some reason I don't seem to be able to do that with the UDF.

I have the Powerpoint.au3 in the Include folder along with the PowerPointConstants.

When I run the below I get the error box that is called upon by the script. Can you tell me what I am missing? I believe this is my fundamental first issue. Once I get this sorted I should be off and running.

#include <PowerPoint.au3>
#include <MsgBoxConstants.au3>


Global $oPPT = _PPT_Open()

If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_Open", "Error creating the PowerPoint application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
MsgBox($MB_ICONINFORMATION, "PowerPoint UDF: _PPT_Open Example 1", "PowerPoint Application has been opened successfully.")

2022-04-15_8-19-48.jpg.455e020547dd86251d7bf7fcfff7be2b.jpg

2022-04-15_8-20-46.jpg.54ec477022f7bc8d8440e7881b6b458c.jpg

Link to comment
Share on other sites

Although, the dll is not properly registered.  Usually it means that you did not install it with the installer.  But it is possible that the registry entries have been modified or has failed at installation.  Manually registering dll is not recommended.

Link to comment
Share on other sites

OK thank you for that, I'll try it out on another PC later today. I did have to do a repair install of Office 365 a week ago, so maybe something went wrong there. Maybe I'll have to uninstall and reinstall it. Thank you for the help though.

Link to comment
Share on other sites

My finished example 🙂

#include <PowerPoint.au3>

Global $oPPT = _PPT_Open()       ;Open Powerpoint
Global $sPresentation = ("C:\Folder\Test1.pptx")
Global $oPresentation = _PPT_PresentationOpen($oPPT, $sPresentation, False)   ;Open Test1 Powerpoint without 'Read-only'
_PPT_PresentationSaveAs($oPresentation, ("C:\Folder\Test2.pptx"), Default, True)  ;Save as Test2.pptx
_PPT_Close($oPPT, False)    ;Close Powerpoint

 

Thank you all for the advice

Edited by boltonebob
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...