2017-01-17 117 views
0

我想改變選定形狀的顏色。如果我點擊一個形狀,我點擊一個按鈕,我想改變紅色的顏色,如圖片,但當我按下按鈕。如何在點擊電源點按鈕時着色形狀?

我如何創建一個按鈕,我把條件改變選擇的顏色形狀?

我試圖通過按另一個形狀來改變顏色,但不是我想要的。

非常感謝

enter image description here

回答

0

OK,所以,首先,因爲你正在試圖更改選定形狀的顏色,這意味着你在正常(編輯)視圖,而不是幻燈片。其次,只有在幻燈片放映模式下才能點擊帶有操作宏的ActiveX按鈕或形狀。因此,在普通視圖中,對「按鈕」的唯一選擇是使用Office的功能區擴展功能。您需要將按鈕的XML添加到PowerPoint文件的customUI中,並創建一個關聯的宏以供其運行。例如,使用CustomUI Editor這個XML添加到您的文件:

// Fluent UI customisation to add a single button to the PowerPoint ribbon // 
// Written by Jamie Garroch of YOUpresent Ltd. http://youpresent.co.uk // 
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"> 
    <ribbon> 
    <tabs> 
     <tab id="tabMyTab" label="My Tab"> 
     <group id="grpMyGroup" label="My Group"> 
      <button id="btnMyButton" label="My Button" onAction="MyMacro"/> 
     </group> 
     </tab> 
    </tabs> 
    </ribbon> 
</customUI> 

...然後關閉在CustomUI編輯該文件,並在PowerPoint中重新打開。當你點擊我的按鈕在您的自定義標籤我的標籤,如果在視圖中的滑動式自選圖形的單一選擇形狀,然後填充顏色會改變

' PowerPoint macro to change the fill colour of a single selected shape 
' Written by Jamie Garroch of YOUpresent Ltd. http://youpresent.co.uk 
Public Sub MyMacro(control As IRibbonControl) 
    With ActiveWindow.Selection 
    If .Type = ppSelectionShapes Then 
     If .ShapeRange.Count = 1 Then 
     If .ShapeRange.Type = msoAutoShape Then 
      .ShapeRange.Fill.ForeColor.RGB = RGB(255, 0, 0) 
     End If 
     End If 
    End If 
    End With 
End Sub 

現在:添加您的宏變紅。