Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA for a macro in PowerPoint to set text box properites

Status
Not open for further replies.
Jul 21, 2009
29
US
I need to change a large number (but not all) text boxes in a presentation so that they are positioned exactly the same and so that they have the same width.

That is, I want to run a macro that changes format and position (width and Horizontal and From position) on the currently selected PowerPoint text box.

I am not used to using VBA in PowerPoint and do not have a clue how to set these properties in a macro.

Robert
 


Hi,

First you need to discover some things like what controls do you have in your presentation. It might also open up some possibilities in your mind.
Code:
Sub test()
    Dim sld As Slide, shp As Shape
    
    For Each sld In ActivePresentation.Slides
        For Each shp In sld.Shapes
            Debug.Print sld.Name, shp.Name, shp.Type, shp.Top, shp.Left, shp.Width, shp.Height
        Next
    Next
End Sub
Also check out this faq707-4594

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
I have no idea how this answers my question.

I do not want to search for text boxes. I do not want a list of existing properties for existing text boxes.

I want to create a macro that will give me just one step (run a macro) when I want to change multiple properties for any text box I already have selected - rather than going into each text box's format and position properties box and making several changes in several tabs in that properties box.
 



Well it tells you that each type of control has a naming convention. You said that you not only had text boxes but other controls (shapes) to position or maybe it is only a subset of the textboxes.

It tells you what the properties are that control the position and size and where they are.

I'd want to know ALL those things before I plunged in to make wholesale changes.

Did you have that information and if so, how did you get it?



Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 


And I just gave you a tool (code) that does stuff that you can use in a macro to do what you need to do.

USE IT. PLAY WITH IT. FIGURE IT OUT.

Ask questions for help. You've got to do some of the heavy lifting. This is not a programming service. Its Tek-Tips

Stretch & grow.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
I think the problem is that you do not work extensively in PowerPoint.

I am sorry that you are upset that your response did not answer my question. I am sorry that I cannot make use of the tool you provided as I am sure it works very well.

Now that I have apologized, maybe you can stop with the rants and maybe someone who knows the answer can chime in.
 



Well what code do you have to start with?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top