2017-02-22 18 views
1

請檢查以下截圖&的代碼。它有我的問題和代碼到目前爲止,我已經寫了(這是不及格)Powerpoint VBA - 將垂直阻擋列表的chldnode向左移

enter image description here

下面是我的代碼:

Private Sub VerticalBlockList() 
    Dim oPPT As PowerPoint.Application 
    Dim oPres As PowerPoint.Presentation 
    Const ppLayoutTitleAndContent As Byte = 32 

    Set oPPT = CreateObject("Powerpoint.Application") 
    Set oPres = oPPT.Presentations.Add() 

    Dim layout As SmartArtLayout 
    Set layout = Application.SmartArtLayouts(26) 

    With oPres.Slides.Add(oPres.Slides.Count + 1, ppLayoutTitleAndContent) 
     With .Shapes.AddSmartArt(layout, 30, 180, 318, 252) 
      With .SmartArt 
       .Nodes(1).Shapes(1).TextFrame2.TextRange.Text = "Sample-1" 
       .Nodes(1).Shapes(2).TextFrame2.TextRange.Text = "Sample-2" 

       ' Below statement throws error. 
       ' basically I want to move the bullet section to little bit on left so that the bullet points doesn't show up 
       ' P.S. there is no way I can remove that bullet in a Vertical Block List 

       .Nodes(1).Shapes(2).left = .Nodes(1).Shapes(2).left - 30 

      End With 
     End With 
    End With  
End Sub 

回答

2

無需移動形狀,你可以只是刪除子彈:

 .Nodes(1).Shapes(2).TextFrame2.TextRange.ParagraphFormat.Bullet.Type = msoBulletNone 
+0

語句執行文件,但子彈仍然存在。你將無法手動刪除它,所以我儘管把它移動到左邊一點點。 – Tejas

+0

當我運行你的代碼時,用代碼替換你移動形狀的那一行以移除項目符號,這些項目符號消失。該SmartArt佈局中的項目符號也可以手動刪除。如果這不適合你,那麼你還有其他問題。 –

+0

您正在使用哪個版本的PPT? –