Attaches to the frist presentation where the search string matches based on the selected mode.
#Include <PowerPoint.au3>
_PPT_PresentationAttach($sString[, $sMode = "FilePath"[, $bPartialMatch = False]])
Parameters
$sString | String to search for. |
$sMode | [optional] specifies search mode: FileName - Name of the open presentation (e.g. "Presentation1.pptx") FilePath - Full path to the open presentation (default) (e.g. "C:\Temp\Presentation1.pptx") Title - Caption of the first window of the presentation (e.g. "Presentation1.pptx [Write protected]") |
$bPartialMatch | [optional] When $sMode = Title then $sString must fully match when False (default) or partial if True |
Return Value
Success: the PowerPoint presentation object.
Remarks
None.
Related
_PPT_PresentationClose, _PPT_PresentationNew, _PPT_PresentationOpen
Example
#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 and open an example presentation
; **********************************************************
Global $sPresentation = @ScriptDir & "\Presentation1.pptx"
Global $oPPT = _PPT_Open()
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_PresentationAttach", "Error creating the PowerPoint application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
Global $oPresentation = _PPT_PresentationOpen($oPPT, $sPresentation)
If @error Then
MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_PresentationAttach Example", "Error opening presentation '" & $sPresentation & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
_PPT_Close($oPPT)
Exit
EndIf
; *****************************************************************************
; Attach to the first presentation where the file path matches
; *****************************************************************************
$oPresentation = _PPT_PresentationAttach($sPresentation)
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_PresentationAttach Example 1", "Error attaching to '" & $sPresentation & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
MsgBox($MB_ICONINFORMATION, "PowerPoint UDF: _PPT_PresentationAttach Example 1", "Search by 'filepath':" & @CRLF & @CRLF & "Successfully attached to presentation '" & $sPresentation & "'.")