VBA Pro Needed - Excel to PowerPoint

KristyP

New Member
Joined
Dec 13, 2018
Messages
6
Hello,

I wrote a macro to pull a large dataset from excel and put it in multiple powerpoint slides....everything works great but the text "pDesc" is often too large for the shape I created in the piece of code below. I have to keep the shape the same size so I have to think of a way to auto-fit the font size into the shape. Any suggestions? I've tried using the LENstring function to do a character count and shrink it that way but it is difficult because the text has many spaces and indents ect.


activeslide.Shapes.AddShape(msoShapeRectangle, 590, 0, 370, 120).TextFrame.TextRange.Text = pDesc

Thank you!!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Re: VBA Pro Needed

Maybe change the reduce the font size.
 
Upvote 0
Re: VBA Pro Needed

Code:
With ActiveSlide.Shapes.AddShape(msoShapeRectangle, 590, 0, 370, 120).TextFrame.TextRange
   .Text = pDesc
   .Font.Size = 8
End With

Not sure this is correct syntax for cross applications but it will give you an idea.
 
Upvote 0

Forum statistics

Threads
1,223,702
Messages
6,173,959
Members
452,539
Latest member
delvey

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top