Jump to content
BamBuVn

Help convert text VBA to autoit!

Recommended Posts

Application.ActivePresentation.Slides(1).Shapes(2) _

    .TextFrame.TextRange.ParagraphFormat.Alignment = ppAlignLeft

Help convert text VBA to autoit!

Thank All!

Share this post


Link to post
Share on other sites

Can you please show us the rest of your AutoIt script? At least the part where you start PowerPoint and open the presentation.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-08-19 - Version 1.4.13.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Taks Scheduler (NEW 2019-10-09 - Version 0.9.0.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#included <Powerpoint.au3> ('?do=embed' frameborder='0' data-embedContent>>)

VBA => https://msdn.microsoft.com/en-us/library/office/ff744029(v=office.14).aspx

Func _save($loi)
    Local $j = 1, $k = 1, $h = 1, $ghep_dong, $tach_dong, $PresInterface, $objPres
    If $loi == '' Then Return 0
    $objPPT = _PPT_PowerPointApp()
    If @error Then
        MsgBox(0, "", "No PowerPoint available")
        Return 0
    EndIf
    $ghep_dong = ''
    $tach_dong = StringSplit($loi & @CRLF, @CRLF)
    $PresInterface = _PPT_CreatePresentation($objPPT) ;Get presentation interface
    $objPres = _PPT_PresentationAdd($PresInterface) ;Add a new presentation
    _PPT_PageSetup($objPres)
    While $h
        For $i = 1 To 6
            If $j >= $tach_dong[0] Then
                $h = 0
                ExitLoop
            EndIf
            $ghep_dong &= $tach_dong[$j] & @CR
            $j += 1
        Next
        $objSlide = _PPT_SlideCreate($objPres, $k, $PPLAYOUTBLANK)
        _PPT_SlideAddTextBox($objSlide, 0, 0, 720, 720) ;add a plain textbox
        _PPT_SlideTextFrameSetText($objSlide, 1, $ghep_dong)
        _PPT_SlideTextFrameSetFontSize($objSlide, 1, 48)
        _PPT_SlideTextFrameSetFont_Bold($objSlide, 1, True)
        $ghep_dong = ''
        $k += 1
    WEnd

    _PPT_PresentationSaveAs($objPres, @ScriptDir & "\Lyrics\" & $title & ".ppt")
    ;_PPT_PresentationClose($objPres) ; Close presentation
    ;_PPT_PowerPointQuit($objPPT) ;Exit PowerPoint
EndFunc   ;==>_save
Edited by BamBuVn

Share this post


Link to post
Share on other sites

So your statement should be:

Global Const $ppAlignLeft = 1 ; Left aligned
$objPPT.ActivePresentation.Slides(1).Shapes(2).TextFrame.TextRange.ParagraphFormat.Alignment = $ppAlignLeft

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-08-19 - Version 1.4.13.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Taks Scheduler (NEW 2019-10-09 - Version 0.9.0.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thank you very much!

edit:

$Alignment => 1 (left), 2 (center), 3 (right)

Func _PPT_SlideParagraphFormat(ByRef $obj, $intTextFrame, Const $Alignment)
    If IsObj($obj) <> 1 Then
        SetError(1)
        Return 0
    Else
        Local $objTextRng = $obj.Slides($intTextFrame).Shapes(1)
        $objTextRng.TextFrame.TextRange.ParagraphFormat.Alignment =  $Alignment
    Endif
EndFunc

Share this post


Link to post
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

×
×
  • Create New...