Ed Matsuoka
asked on
Select and fill in textboxes
Hi experts:
I have a Powerpoint presentation with upwards of 100 text boxes per slide. Right now, to change the numbers in those text boxes we have to manually click on each text box. I need a macro that allows me to select all these text boxes and then, perhaps using input boxes, change all the numbers, a row at a time.
Have a great day!
I have a Powerpoint presentation with upwards of 100 text boxes per slide. Right now, to change the numbers in those text boxes we have to manually click on each text box. I need a macro that allows me to select all these text boxes and then, perhaps using input boxes, change all the numbers, a row at a time.
Have a great day!
What do you mean, "a row at a time"?
ASKER
01 02 03 04 05 06 07 08 09
10 11 12 13 14 15 16 17 18
20 21 22 23 24 25 26 27 28
I was imagining something like an input box that would pop up and ask for the new entry for row 1/col 1 (01 becomes 12), row 1/col 2 (02 becomes 08), row 1/col 3 (03 becomes 32), etc. This input box would contain the current number in the text box so that if that number doesn't change you could just hit ENTER and go to the next text box. Ideally this would turn the process of changing an 9 x 9 matrix of text boxes from 20 minutes of click box/change box entry tedium to 3 minutes of fast typing!
10 11 12 13 14 15 16 17 18
20 21 22 23 24 25 26 27 28
I was imagining something like an input box that would pop up and ask for the new entry for row 1/col 1 (01 becomes 12), row 1/col 2 (02 becomes 08), row 1/col 3 (03 becomes 32), etc. This input box would contain the current number in the text box so that if that number doesn't change you could just hit ENTER and go to the next text box. Ideally this would turn the process of changing an 9 x 9 matrix of text boxes from 20 minutes of click box/change box entry tedium to 3 minutes of fast typing!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Jamie!
Thanks for the macro, it is almost perfect. My problem is that the text box names are "out of order" so the macro will jump around. I thought of a fix that might work by first renaming the text boxes based on their location on the screen (i.e., NewName="txtbox_" & shape.row & shapecol. How would I do that?
Eddie
Thanks for the macro, it is almost perfect. My problem is that the text box names are "out of order" so the macro will jump around. I thought of a fix that might work by first renaming the text boxes based on their location on the screen (i.e., NewName="txtbox_" & shape.row & shapecol. How would I do that?
Eddie
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I added this code to the beginning of your code:
'------------------------- ---------- ---------- ---------- ---------- ---------- ---
' First rename textboxes to they are in order
'------------------------- ---------- ---------- ---------- ---------- ---------- ---
With ActiveWindow.Selection
For Each oShp In .ShapeRange
With oShp
NewName = "txt_" & Trim$(Int(.Left)) & Trim$(Int(.Top))
End With
Next
End With
I made the mistake of thinking the text boxes go in order of name but in researching a bit more I see their TAB order is ALWAYS set by creation order and can't be changed in code. That means I either need to set up a series of template slides with the text boxes created left-to-right/top-to-botto m OR I need to set up some code that stores the text box text into an array (left-to-right/top-to-bott om), deletes the old text boxes and recreates them in the right TAB order. Am I right that I can't reset the TAB order on the fly?
'-------------------------
' First rename textboxes to they are in order
'-------------------------
With ActiveWindow.Selection
For Each oShp In .ShapeRange
With oShp
NewName = "txt_" & Trim$(Int(.Left)) & Trim$(Int(.Top))
End With
Next
End With
I made the mistake of thinking the text boxes go in order of name but in researching a bit more I see their TAB order is ALWAYS set by creation order and can't be changed in code. That means I either need to set up a series of template slides with the text boxes created left-to-right/top-to-botto
The "tab" order that you describe is the same order as I mentioned before e.g. the layer (Z-Order) ordering. When shapes are created, the latest one is added to the top layer so yes, in a way, the order is as you say. But, the incorrect part is that this order CAN be changed:
1. Via the user interface's Selection Pane (Alt+F10 for PowerPoint 2013 and 2010)
2. Programmatically via the shape's Z-Order property
Your method for renaming them according to their on-slide position makes sense and you could also change the Z-Order at the same time using:
1. Via the user interface's Selection Pane (Alt+F10 for PowerPoint 2013 and 2010)
2. Programmatically via the shape's Z-Order property
Your method for renaming them according to their on-slide position makes sense and you could also change the Z-Order at the same time using:
oShp.ZOrder msoBringToFront