Warm tip: This article is reproduced from stackoverflow.com, please click
vba powerpoint-vba

Code to Change Cell Value in PowerPoint(Office 365) VBA

发布于 2020-03-27 10:28:13

I'm making a game inside PPT for cybersecurity awareness month for my company. I'm using VBA to make a couple of extra features that make it slightly nicer than just a jeopardy style quiz. I've already gotten buttons to work (action buttons) that can hide pictures / make them visible, as well as a button that can change the text on another slide (E.g button on slide 2 sets global variable to "boop" and then changes textbox on slide 1).

Right now i'm trying to figure out the code to do the same thing with a table made inside the slide. The table is already made (and renamed "testtable").

I want to select for example A2, and then make A2 = boop. I've tried a bunch of different code but can't figure out how to change the cell value.

Thanks for help

This code has worked perfectly to change text on a different slide

ActivePresentation.Slides(1).Shapes("textbox").TextFrame.TextRange.Text = randomInt

I've tried things like

ActivePresentation.Slides(3).Shapes("testtable").table.TextFrame.TextRange.Text = randomInt

I've tried changing the .text to .value. i've tried a bunch of other things but how card can it be to change a single cell?!

Questioner
Nicolas Bulgarides
Viewed
16
bm13563 2019-07-03 23:17
ActivePresentation.Slides(3).Shapes("testtable").Table.Cell(2, 1).Shape.TextFrame.TextRange.Text = randomInt

See the docs.