简体   繁体   English

Powerpoint上的VBA:如何制作变量以使其能够在每张幻灯片上使用?

[英]VBA on powerpoint: how to make a variable to make it able to used on every slides?

So on Office 2013 Powerpoint, I'm trying to make a Jeopardy game... I'm going to create buttons on each ANSWER slides. 因此,在Office 2013 Powerpoint上,我试图制作一个危险游戏...我将在每个ANSWER幻灯片上创建按钮。 What this button will do is: Set a variable "Amount" to according amount of money the question is worth. 该按钮将执行的操作是:根据问题的价值设置变量“金额”。 After that, it changes the slide to the SCORING slide. 之后,它将幻灯片更改为SCORING幻灯片。

Here is the question... How do you make it, so the variable "Amount" (whether it's 100, 200, etc.) to be used on the SCORING slide? 这是一个问题……您是如何做到的,因此要在SCORING幻灯片上使用变量“金额”(无论是100、200等)? I think I'm suppose to use PUBLIC somehow, but I'm a newbie and I can't figure it out... 我想我应该以某种方式使用PUBLIC,但是我是新手,所以我不知道...

At the top of any module in the project do 在项目中任何模块的顶部执行

Public lAmount as Long

The value of the variable will be available to all modules in the project. 该变量的值将可用于项目中的所有模块。 You might want to dim the variable as some other type, but for Jeopardy, Long will do fine. 您可能希望将变量设为其他某种类型,但对于Jeopardy,Long会很好。

Check out the answers to this question, it should help you out. 查看该问题的答案,它应该可以为您提供帮助。 If you're still stuck after that, let me know. 如果您在那之后仍然陷于困境,请告诉我。

Setting Global Variables in VBA 在VBA中设置全局变量

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM