2016-07-01 2 views
1

다른 테이블에 한 페이지에 파워 포인트 테이블의 전체 행을 붙여 넣기 (Determining if a powerpoint text box is over the page size)방식을 볼 수 결정 내 질문에 관련 이전 페이지

나는 테이블의 행을 이동해야 한 페이지에서 이전 페이지로.

내가자를 필요가있는 행을 간단히 결정하는 것은 간단합니다 (간결하게하기 위해 코드의 일부분을 남겼습니다). 문제가 발생하는 곳은 이전 페이지의 표에 다시 붙여 넣는 방법입니다 (표에는 동일한 열 크기가 있음).

UI에서 커서를 대상 행의 첫 번째 셀에 놓고 붙여 넣기 만하면됩니다. 이것은 절단 된 행의 열 구조를 완전히 복제합니다. VB에서는 잘라 내기 행 (모든 열)의 전체 텍스트를 한 셀에 붙여 넣기 만하면됩니다. UI에서 무슨 일이 일어나고 있는지 복제 할 수있는 VB 코드가없는 것 같습니다. 내가 누락 된 명령은 무엇입니까? 코드의

For y = 2 To c 
Set oSh = ActivePresentation.Slides(k + 1).Shapes("ProgTable") 
With oSh.Table 
    .Rows(y).Select 
End With 

Windows(1).Selection.Cut 
Set oSh = ActivePresentation.Slides(k).Shapes("ProgTable") 

With oSh.Table 
    .Rows.Add (-1) 
    .Cell(oSh.Table.Rows.Count,1)textFrame.TextRange.Paste 'pastes all columns into the one cell 
End With 


Next y 

다른 라인은 내가 당신은 TextRange에 붙여 넣기하고

.Rows(oSh.Table.Rows.Count).Cells.Item.Shape.TextFrame.TextRange.PasteSpecial (PpPasteDataType.ppPasteHTML) 
'does not work, gives compile error on ITEM argument not optional 

답변

0

를 동작하지 않습니다 클립 보드를 붙여 아닌 테이블/자체를 행. PPT의 객체 모델에는 펑키 한 것들이 분명히 있습니다. 직관적이어야하는 (복사/붙여 넣기) 액션이없는 경우가 종종 있습니다. 이러한 경우에 Application.CommandBars.ExecuteMSO 메서드는 일반적으로 어디서 시작합니까? (Excel> PowerPoint, Word> PowerPoint 등과 같이 copying from/between different applications 인 경우 매우 유용합니다)

나는 이것을 테스트하여 예상대로 작동하지만, 코드에 따라서

Sub CopyRowToAnotherTable() 

Dim tbl1 As Table 
Dim tbl2 As Table 
Dim sld1 As Slide 
Dim sld2 As Slide 
Dim pres As Presentation 

Dim shp As Shape 

Set pres = ActivePresentation 
Set sld1 = pres.Slides(1) 
Set sld2 = pres.Slides(2) 
Set tbl1 = sld1.Shapes(1).Table 
Set tbl2 = sld2.Shapes(1).Table 

'Cut the last row from tbl2: 
sld2.Select '## Powerpoint requires the slide to be active/view in order to select shapes on the slide 
With tbl2 
    .Rows(.Rows.Count).Select 
    pres.Windows(1).Selection.Cut 
End With 

'Insert in tbl1 
With tbl1 
    .Rows.Add -1 
    sld1.Select 
    .Rows(.Rows.Count).Select 
    pres.Application.CommandBars.ExecuteMso "Paste" 
End With 
End Sub 

, 난이 일을해야한다고 생각 :

With oSh.Table 
    '## select the slide: 
    .Parent.Parent.Select 
    .Rows.Add (-1) 
    .Rows(.Rows.Count).Select 
    Application.CommandBars.ExecuteMso "Paste" 
End With 

ExecuteMso 방법에 대한 까다로운 부분이 잘 문서화 아니라고 주로 그래서 바른 길에 당신을 설정해야 , 또는 그렇지만 어렵습니다. ExecuteMso 방법에

문서 : 그래서 여기 a previous answer에서 참조입니다,에게 DOX을 찾을

http://msdn.microsoft.com/en-us/library/office/ff862419.aspx

각 Office 응용 프로그램에 대한 idMSO 매개 변수를 포함

다운로드 문서 :

http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=6627

+1

감사합니다! 커맨드 바 기능을 보았지만 실제로 페이지 컨텍스트 내에서이를 구현하는 방법은 현재 없습니다. 매우 도움이됩니다. 그리고 나는 그것이 열렬히 필요하다고 느꼈다는 것이 훨씬 더 어려웠다는 것에 내가 미치지 않았기 때문에 기쁘다. –