Excel Hints

Results 1 to 3 of 3

Thread: Solved: Add textbox to powerpoint and change font color

  1. #1

    Solved: Add textbox to powerpoint and change font color

    Hi all,

    I've been using this script to create a Powerpoint slideshow from an Access db. This code is actually in the Access VBA, but I thought of it as more of a Powerpoint question, so I hope I posted in the right forum.
    The script is working quite well. I've managed to modify it to do what I need.
    The problem is, I've added a text box, but can't figure out how to change the color of the text for that particular text box. Here's a snip of the code:

    While Not rs.EOF
    With .Slides.Add(rs.AbsolutePosition + 1, ppLayoutClipartAndText)
    'Array
    Dim varAddress As Variant
    varAddress = Split(rs.Fields("Address"), ",")
    'Dim intLen As Integer
    'intLen = Len(varAddress(0))
    'varAddress = Left(varAddress(0), intLen - 1)
    .ColorScheme.Colors(ppBackground).RGB = RGB(0, 37, 105)
    'CStr(rs.Fields("Address"))
    .Shapes(1).TextFrame.TextRange.Text = varAddress(0)
    .Shapes(1).TextFrame.TextRange.Characters.Font.Color = RGB(255, 255, 255)
    .SlideShowTransition.EntryEffect = ppEffectRandom
    With .Shapes
    Dim piclink As String
    piclink = "C:\Backup Webs\042506\pics\" & CStr(rs.Fields("Property_ID")) & "l-1.jpg"
    .AddPicture piclink, msoTrue, msoTrue, 30, 175, 310, 180
    .AddTextbox(msoTextOrientationHorizontal, 30, 125, 300, 100).TextFrame.TextRange.Text = CStr(rs.Fields("City"))

    End With
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''
    With .Shapes
    Dim piclink1 As String
    piclink1 = "C:\Backup Webs\042506\images\CBimages\newhome2-top_01.jpg"
    .AddPicture piclink1, msoTrue, msoTrue, 500, 400, 194, 134
    End With
    -----------------------------------------------------------------------
    I highlighted where I've added the text box, right after I've added a picture, but how can I change the color of the text in the textbox I just added? I can't figure out how to access it. Would it have an index? (like pre-existing shape controls?) so I can write textbox(1) . . .?

    Thanks for any help,
    Carrie

  2. #2

    Solved my own problem

    Well, if I had tried this before I posted:

    With .AddTextbox(msoTextOrientationHorizontal, 30, 125, 300, 100).TextFrame
    .TextRange.Text = CStr(rs.Fields("City"))
    .TextRange.Font.Color = RGB(255, 255, 255)
    End With

    Then I would have found the answer I was looking for.

    Thanks,
    Carrie

  3. #3
    Moderator VBAX Master geekgirlau's Avatar
    Joined
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,464
    Location
    Hi Carrie,

    Wow - you've posted a problem and solved a problem in a matter of minutes! Welcome to the Board.

    I've marked this thread as "Solved" for you - you can do this in future by clicking on "Thread Tools" at the top of the page and selected "Mark thread solved".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •