TextEffect to TextFrame Adjustment Mismatch

0 votes

A shape on a PowerPoint slide would be replaced with a sub() I have. A set of cells from Excel were put into the existing shape (PasteSpecial DataType:=0). I'm attempting to insert a newer version of the same range to replace the copied range on the slide. With the exception of, I think my current code is correct. TextEffect. Where I'm getting a "Type Mismatch" error in the text. Is this because it's a group of cells rather than a single cell? I've looked through other discussions, but I'm not sure what modification this particular line of code needs.

Sub ReplaceTable()
  Dim PowerPointApp As PowerPoint.Application
  Dim myPresentation As PowerPoint.Presentation
  Dim i As Object
  
  Set PowerPointApp = GetObject(, "PowerPoint.Application")
  Set myPresentation = PowerPointApp.ActivePresentation
  
  Dim SlideIndex
  Dim SlideShape
  Dim ShapeContent

  For Each i In Worksheets("Sheet1").Range("H2:H" & Worksheets("Sheet1").Range("H" & Rows.Count).End(xlUp).Row)
  
    SlideIndex = Worksheets("Sheet1").Range("H" & i.Row) 'moves to defined slide index
    SlideShape = "Content Placeholder 3" 'selects shape
    ShapeContent = Worksheets("Sheet2").Range("D9:V24") 'copies new tabular data to replace current table on slide
    myPresentation.Slides(SlideIndex).Shapes(SlideShape).TextEffect.Text = ShapeContent
    
  Next i
  
  
End Sub
Mar 25, 2023 in Others by Kithuzzz
• 38,000 points
657 views

1 answer to this question.

0 votes

Delete the original shape and then replace, it as so:

ShapeContent.Copy 
myPresentation.Slides(SlideIndex).Shapes(SlideShape).Delete
myPresentation.Slides(SlideIndex).Shapes.PasteSpecial DataType:=0
answered Mar 25, 2023 by narikkadan
• 63,600 points

Related Questions In Others

0 votes
1 answer

Type mismatch error when referring to array element by location vba

We utilise MID to parse the string. ...READ MORE

answered Feb 11, 2023 in Others by Kithuzzz
• 38,000 points
773 views
0 votes
1 answer

How to check if array is multidimensional or not?

Since the 'second dimension' could be just ...READ MORE

answered Nov 5, 2018 in Others by DataKing99
• 8,250 points
6,000 views
0 votes
1 answer
0 votes
1 answer

How is machine learning used to detect objects?

To understand the surrounding environment in real ...READ MORE

answered Nov 30, 2018 in Others by Kailash
857 views
0 votes
1 answer

How to modify Powerpoint Chart ChartData by Excel VBA

Example: Code: Set pptApp = GetObject(, "PowerPoint.Application") Set pptPres = ...READ MORE

answered Oct 16, 2022 in Others by narikkadan
• 63,600 points
3,048 views
0 votes
1 answer

Using excel I need to open PPT and create ".gif" image of a ."pdf" and save it

It appears happier if you get a ...READ MORE

answered Dec 24, 2022 in Others by narikkadan
• 63,600 points
490 views
0 votes
1 answer

Changing code to adjust number of charts on each powerpoint slide VBA

Try this: Option Explicit Sub CopyChartsToPowerPoint() ...READ MORE

answered Jan 23, 2023 in Others by narikkadan
• 63,600 points
552 views
0 votes
1 answer

VBA Check to see if file is open before reopening a second file

You could replace the line: Set pre = ...READ MORE

answered Apr 4, 2023 in Others by Kithuzzz
• 38,000 points
910 views
0 votes
1 answer

how to show the <meta> values of yoast seo with some function?

check this folder : wordpress-seo\src\presenters\open-graph you can ...READ MORE

answered Feb 10, 2022 in Others by narikkadan
• 63,600 points
621 views
0 votes
1 answer

How to echo WP SEO Yoast synonyms in PHP?

 the meta_key in wp_postmeta table is _yoast_wpseo_keyword ...READ MORE

answered Feb 10, 2022 in Others by narikkadan
• 63,600 points
1,145 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP