简体   繁体   English

MS 电源点中的变量

[英]Variables in MS power point

Hi I am creating a powerpoint 2013 presentation in which we will be using some hyperlinks on many slides.嗨,我正在创建一个 2013 年的 powerpoint 演示文稿,我们将在其中使用许多幻灯片上的一些超链接。 The hyperlinks point to an external site.超链接指向外部站点。 This server may change later and then I would need to change all these hyperlinks individually, which is quite a pain.这个服务器以后可能会更改,然后我需要单独更改所有这些超链接,这很痛苦。

Is there a way by which I could define a variable in power point( maybe in the VBA section ) and then use this variable , which could be base website address, to construct the hyperlinks in the slides.有没有办法在power point(可能在VBA部分)中定义一个变量,然后使用这个变量(可能是基本网站地址)来构建幻灯片中的超链接。 This way if the website changes, then I only need to change the value of this variable.这样如果网站改变了,那么我只需要改变这个变量的值。 Is this possible to do and if yes, how ?这是可能的吗,如果是,怎么做?

Thanks for your help !谢谢你的帮助 !

There's no way to save the desired link address as, say, a field code as you might be able to do in Word, but if you don't mind running a bit of code to do the fixup, this will let you replace any specific chunk of text with any other text.无法像在 Word 中那样将所需的链接地址保存为域代码,但如果您不介意运行一些代码来进行修复,这将让您替换任何特定的文本块与任何其他文本。 You supply the bits.您提供位。 In the example below, I'm replacing pptools with pptfaq, to turn all hyperlinks to http://www.pptools.com into http://www.pptfaq.com在下面的示例中,我将 pptools 替换为 pptfaq,将所有指向http://www.pptools.com 的超链接转换为http://www.pptfaq.com

Edit the first two lines as needed:根据需要编辑前两行:

Const sOldHyperlink As String = "pptools"
Const sNewHyperlink As String = "pptfaq"

Sub ChangeHyperlinks()

    Dim oSl As Slide
    Dim oHl As Hyperlink

    For Each oSl In ActivePresentation.Slides
        For Each oHl In oSl.Hyperlinks
            oHl.Address = Replace(oHl.Address, sOldHyperlink, sNewHyperlink)
        Next
    Next

End Sub

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

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