Powerpoint VBA 宏复制对象的大小和位置并粘贴到另一个对象

发布于 2024-11-19 09:54:26 字数 243 浏览 3 评论 0原文

刚刚从 Windows 切换到 Mac,在 Windows 上的 ppt 中,我有一个插件,允许我复制对象的属性(包括大小和/或位置)并将其粘贴到另一个对象,有点像高级格式画家,可以切换您的属性我想复制。

我不再有这个插件,但我非常想创建一个简单的宏来复制大小和位置。这有可能吗?如果是的话,您能否提供代码或向我指出一个可以自学的资源?

我花了大约 2 个小时搜索,但找不到 Office Mac 兼容的解决方案 - 所以这是我最后的希望!

Just switched to Mac from Windows and in ppt on Windows I had an addin that allowed me to copy an object's properties including size and/or location and paste it to another object, sort of like an advanced format painter with toggles for the properties you'd like to copy.

I don't have this addin anymore, but I'd very much like to create a simple macro to copy size and location. Is this in the realm of possibility? If so could you provide the code or point me at a resource where I can teach it to myself?

I've spent about 2 hours searching and can't find an office mac compatible solution - so this is my last hope!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦幻的味道 2024-11-26 09:54:26

这是一个有效的示例。您可以对其进行调整以满足您的特定需求。

Sub CopySizeAndPosition()

    ' Usage: Select two shapes. The size and position of
    ' the first shape selected will be copied to the second.

    Dim w As Double
    Dim h As Double
    Dim l As Double
    Dim t As Double

    With ActiveWindow.Selection.ShapeRange(1)
        w = .Width
        h = .Height
        l = .Left
        t = .Top
    End With
    With ActiveWindow.Selection.ShapeRange(2)
        .Width = w
        .Height = h
        .Left = l
        .Top = t
    End With

End Sub

Here's an example that works. You can adapt it to suit your specific needs.

Sub CopySizeAndPosition()

    ' Usage: Select two shapes. The size and position of
    ' the first shape selected will be copied to the second.

    Dim w As Double
    Dim h As Double
    Dim l As Double
    Dim t As Double

    With ActiveWindow.Selection.ShapeRange(1)
        w = .Width
        h = .Height
        l = .Left
        t = .Top
    End With
    With ActiveWindow.Selection.ShapeRange(2)
        .Width = w
        .Height = h
        .Left = l
        .Top = t
    End With

End Sub
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文