Jump to content
BamBuVn

Help convert text VBA to autoit!

Recommended Posts

BamBuVn

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
water

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

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
BamBuVn

#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
water

So your statement should be:

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

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
BamBuVn

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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.