代码之家  ›  专栏  ›  技术社区  ›  Joshua Abraham Yuan

如何使用powerpoint vba,在右侧显示选择面板,在左侧显示以下面板,并将其展开-填充、大小、图片

  •  0
  • Joshua Abraham Yuan  · 技术社区  · 2 年前

    我使用的环境是office365

    如何使用powerpoint vba,
    如下图所示

    停靠右侧的选择面板
    下面的任务窗格位于左侧,并已展开:

    填充和线条
    大小和位置
    图片校正作物


    我在这里指的是结果
    因为我想要的是这样的东西。

    Dock TaskPanes right using VBA for Word 07?

    我已经测试了这个答案的代码。
    它运行良好,非常棒!

    ' Opens the Formatting task pane (Style window)
            Application.TaskPanes(wdTaskPaneFormatting).Visible = True
    
    ' Docks the Formatting pane on the right
            Application.CommandBars("Styles").Position = msoBarRight
    

    但我发现powerpoint似乎不喜欢word,
    应用 任务窗格 (WDTaskPaneforming)。可见=真实
    有一个属性可以调用。


    在Powerpoint选项中
    你可以在这里找到 You can find it here

    项目名称
    Item name


    填充和线条
    大小和位置
    图片校正作物


    Fill and Line

    Size and Position

    Picture Corrections Crop




    我试过了


    下面的代码有效

    ActiveWindow.Activate
    If Not CommandBars.GetPressedMso("SelectionPane") Then CommandBars.ExecuteMso ("SelectionPane") 
    'Show the Selection Panel on the right
    

    以下代码不起作用
    我运行之后,
    我得到了以下结果。

    ActiveWindow.Activate
    If Not CommandBars.GetPressedMso("ObjectSizeAndPositionDialog") Then CommandBars.ExecuteMso ("ObjectSizeAndPositionDialog") 
    'Size and Position panel
    
    If Not CommandBars.GetPressedMso("PictureCorrectionsDialog") Then CommandBars.ExecuteMso ("PictureCorrectionsDialog")
    'Picture Corrections Crop panel
    
    'I want to activate these panels - 
    
    'Fill and Line
    'Size and Position, 
    'Picture Corrections Crop
    
    'I don't know how to make it go to the left and expand
    
    'I don't know Fill and Line panel its ExecuteMso id
    'I know Size and Position panel its ExecuteMso id is - ObjectSizeAndPositionDialog
    'I know Picture Corrections Crop panel its ExecuteMso id is - PictureCorrectionsDialog
    

    Execution Results

    0 回复  |  直到 2 年前
        1
  •  0
  •   Joshua Abraham Yuan    2 年前

    填充和线条
    大小和位置
    图片校正作物


    命令栏。ExecuteMso(“ObjectSizeAndPositionDialog”)

    我发现了
    这个代码是错误的。
    因为我没有选择对象。

    所以你可以先用鼠标选择它。 或者做我做过的事
    然后用程序选择一件事

    活动窗口。看法滑梯_
    .形状。占位符。项目(3)。文本框。文本范围。选择


    填充和线条

    Sub openPaneSltFill()
      
    ActiveWindow.Activate
    Application.CommandBars.ExecuteMso ("SelectionPane")
    
    ActiveWindow.View.Slide _
    .Shapes.Placeholders.Item(3).TextFrame.TextRange.Select 'need select obj will not bug
    
    Application.CommandBars.ExecuteMso ("MoreLines2")
    'Application.CommandBars("MoreLines2").Position = msoBarLeft 'not work ; I don't know how to dock it on the left
    

    大小和位置

    Sub openPaneSltObjSize()
    
    ActiveWindow.Activate
    Application.CommandBars.ExecuteMso ("SelectionPane")
    
    ActiveWindow.View.Slide _
    .Shapes.Placeholders.Item(3).TextFrame.TextRange.Select 'need select obj or will bug
    
    Application.CommandBars.ExecuteMso ("ObjectSizeAndPositionDialog")
    'Application.CommandBars("ObjectSizeAndPositionDialog").Position = msoBarLeft 'not work ; I don't know how to dock it on the left
    
    End Sub
    

    图片校正作物
    需要先选择图片吗

    Sub openPanePicPst()
    
    ActiveWindow.Activate
    Application.CommandBars.ExecuteMso ("SelectionPane")
    
    Application.CommandBars.ExecuteMso ("PictureCorrectionsDialog") 'need select Pic or will bug
    'Application.CommandBars("PictureCorrectionsDialog").Position = msoBarLeft 'not work ; I don't know how to dock it on the left
    
    End Sub
    

    但我还是找不到办法

    停靠以下任务窗格位于左侧,
    并进行了扩展。

    填充和线条
    大小和位置
    图片校正作物


    如果有一个非常好的人
    愿意帮忙
    我将非常感谢他