Jump to content

Recommended Posts

Posted (edited)

I've setup the following code to build a PPT:

$oPPT = ObjCreate("PowerPoint.Application")
    $oPresentation = $oPPT.Presentations.Open($File)
    If @error Then
        MsgBox(0, "Error", "Error opening Presentation")
        Exit
    EndIf
    $slide=$oPPT.ActiveWindow.View.Slide
    With $slide
        $objObjectiveText=.Shapes.AddTextBox(1,118,88,350,65) ;.AddTextbox(Orientation, Left, Top, Width, Height)
        $objObjectiveText.TextFrame.AutoSize = 0 ;No autosize textbox
        $objObjectiveText.TextFrame.TextRange.Text = "THIS IS A TEST"
        $objObjectiveText.TextFrame.TextRange.Font.Name = "Times New Roman"
        $objObjectiveText.TextFrame.TextRange.font.size = 10
        $objObjectiveText.Line.Visible = -1 ;msoTrue
        $objObjectiveText.Line.ForeColor.RGB = _WinAPI_RGB(0,0,255) ;Red
        $objObjectiveText.Line.Weight = 2
    EndWith

I've been googling like mad trying to figure out how to add a shadow to the text box but everything I try seems to error. I've tried:

Line.Shadow=true

Line.shadow.type=1 (supposed to be the offset diag right)

TextFrame.Shadow=True

BorderStyle.SpecialEffect = 4

TextFrame.TextRange.Line.Shadow = 1

I even tried a few TextFrame2 (basically the same way I was doing it above)

 

Anyone know the VB command to add shadow to a text box?

 

 

Edited by Jewtus
Posted
$objObjectiveText.Shadow.x

where x is any of the properties you can find here: https://msdn.microsoft.com/en-us/library/ff744621(v=office.14).aspx
This is untested as I do not have PP available at the moment.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

 

  • Moderators
Posted (edited)

Something like this (can't recall which version this was for)

x = ActivePresentation.Slides(4).Shapes(1)
Set tr = x.TextFrame2.TextRange
    With tr.Font.Shadow
        .OffsetX = 10
        .OffsetY = 10
        .Size = 1
        .Blur = 4
        .Transparency = 0.5
        .Visible = True
    End With

 

Edit: Too slow :)

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted

Ya, I saw some things like that, but I wasn't 100% sure how to invoke it. That one specifically puts a shadow on the text, but not the box itself. I did figure it out from some ridiculously obscure forum for doing something similar in word. This is what I came up with and I tested it and it works.

 

Func FormatTextBox($shape)
    $fillRed =_WinAPI_RGB(0,0,255) ;Red
    $fillWhite =_WinAPI_RGB(255,255,255) ;white
    With $shape
        .TextFrame.AutoSize = 0 ;No autosize textbox
        .Fill.Solid
        .Fill.ForeColor.RGB = $fillWhite
        .Shadow.Visible = True
        .Shadow.Transparency = .6
        .TextFrame.TextRange.Text = "THIS IS A TEST"
        .TextFrame.TextRange.Font.Name = "Times New Roman"
        .TextFrame.TextRange.font.size = 10
        .Line.Visible = -1 ;msoTrue
        .Line.ForeColor.RGB = $fillRed
        .Line.Weight = 2
    EndWith
EndFunc

 

Posted

Exactly what I proposed above ;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

 

Posted

Exactly what I proposed above ;)

​Yup! I didn't realize though that I had to set it to visible or nothing really happened. The stuff I was reading was saying to use shadow.type=4 (some mso variable) to get what I wanted, but when I set it to visible it actually gets the correct shadow type so I just needed to change the transparency to match the rest of my PPT.

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
  • Recently Browsing   0 members

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