DaveDD
DaveDD

Reputation: 63

Powerpoint 2013 VBA stops running when changing .Text property of a Textbox

I have been trying to change the .text property of a textbox using the following line of VBA code:

Application.ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange.Text = "File copy completed."

The textbox is the only shape on the slide.

I placed a msgbox() call before and after this line of code and found that the code seems to be stopping when this line is called.

The textbox WILL update correctly if I manually change it to something else before running the code but it will only update once.

If anyone can offer advice I would appreciate it.

Thank you.

Upvotes: 1

Views: 49

Answers (1)

DaveDD
DaveDD

Reputation: 63

I found a solution mentioned in this thread: Apply Font Formatting to PowerPoint Text Programatically

I declared a TextRange object and set it to the TextRange that I was changing. By using the object instead of the TextRange directly my code does not stop like it was before.

Upvotes: 2

Related Questions