Consulting

Results 1 to 5 of 5

Thread: Excel to Powerpoint Text Size

  1. #1

    Excel to Powerpoint Text Size

    Hi. I'm a comparatively novice programmer, and have come up with a problem that feels like it should have an easy answer, but I can't find it.
    If I manually highlight a cell in Excel, with the word Income in 32point text, then paste it into Powerpoint using the second of the five options (keep formatted text), I get the text, in 32 point, and it is alterable - my aim is to add a drop shadow on all my text.
    When using VBA to copy it across I get one of two results, depending on which setting I use. I either get editable text, but at the wrong size (32 point drops to 18 point), or a get the right size, but not editable (i.e. more as a picture).
    My code is as follows

    Sub CaloutDownArrow179200_Click()
    Dim rng As Range
    Dim PowerPointApp As Object
    Dim myPresentation As Object
    Dim mySlide As Object
    Dim myShape As Object

    'Create an Instance of PowerPoint
    On Error Resume Next
    'Is PowerPoint already opened?
    Set PowerPointApp = GetObject(Class:="PowerPoint.Application")
    'Clear the error between errors
    Err.Clear
    'If PowerPoint is not already open then open PowerPoint
    If PowerPointApp Is Nothing Then Set PowerPointApp = CreateObject(Class:="PowerPoint.Application")
    'Handle if the PowerPoint Application is not found
    If Err.Number = 429 Then
    MsgBox "PowerPoint could not be found, aborting."
    Exit Sub
    End If
    On Error GoTo 0

    'Optimize Code
    Application.ScreenUpdating = False

    'Create a New Presentation
    Set myPresentation = PowerPointApp.Presentations.Add
    myPresentation.PageSetup.SlideSize = 1
    '----------------------------------------------------------------------------------

    'Add a slide to the Presentation
    Set mySlide = myPresentation.Slides.Add(1, 12)
    With mySlide
    .FollowMasterBackground = msoFalse
    .Background.Fill.Solid
    .Background.Fill.ForeColor.RGB = RGB(0, 51, 204)
    End With
    Application.CutCopyMode = False
    Set rng = ThisWorkbook.Worksheets("Slide 2").Range("c5")
    rng.Copy
    'Paste to PowerPoint
    mySlide.Shapes.PasteSpecial DataType:=8
    Set myShape = mySlide.Shapes(mySlide.Shapes.Count)

    ''''Set myShape = mySlide.Shapes.PasteSpecial(DataType:=8) '8 = ppPasteHTML
    ''''Application.CutCopyMode = False

    myShape.Top = (myPresentation.PageSetup.slideheight - myShape.Height) / 2
    myShape.Left = (myPresentation.PageSetup.slidewidth - myShape.Width) / 2

    'Make PowerPoint Visible and Active
    PowerPointApp.Visible = True
    PowerPointApp.Activate

    'Clear The Clipboard
    Application.CutCopyMode = False

    End Sub

    I can only assume the problem is the blue text above, sending the text to Powerpoint. I have tried using all different numbers for datatype, but none keeps the size and formatting.
    I have also tried replacing the red text with the blue text, but with the same results.

    I am using Powerpoint and Excel in Office 365

    Can you help me here?
    Stickerman

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Cross-posted at: https://www.mrexcel.com/board/thread...-text.1130535/
    Please read VBA Express' policy on Cross-Posting in Rule 3: http://www.vbaexpress.com/forum/faq...._new_faq_item3
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Hi. I'm sorry if I'm doing something wrong here. I don't really understand what you mean by cross posting. I had started a thread in Mr. Excel, but they hadn't been able to answer my query, hence i tried here.
    Are you the same organisation?

  4. #4
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Cross-posting, sometimes called multiposting, is when you post the same question on multiple forums. That is explained in the rule I pointed you to. Please familiarize yourself with this forum's rules - which you agreed to abide by when you joined.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  5. #5
    Quote Originally Posted by macropod View Post
    Cross-posting, sometimes called multiposting, is when you post the same question on multiple forums. That is explained in the rule I pointed you to. Please familiarize yourself with this forum's rules - which you agreed to abide by when you joined.
    Ah thank you for explaining it to me. For us silver surfers, already somewhat lost in the jungle of Excel programming, it can be a bit daunting to get a message warning of something done wrong. I'll try to be more careful in the future.

Posting Permissions

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