2014-12-17 3 views
1

나는 파워 포인트 vba에 새로운 있습니다. 내가 원하는 것은 단추를 클릭하여 선택에 따라 슬라이드의 레이아웃을 변경할 수있는 코드 조각을 작성하는 것입니다. "개체가이 속성 또는 메서드를 지원하지 않습니다"파워 포인트 VBA 런타임 오류 438 (쉬운)

Private Sub CommandButton1_Click() 'Klick Button 1' 

ActivePresentation.Slides(10).Delete 
ActivePresentation.Slides(9).Delete 
ActivePresentation.Slides(8).Delete 

Dim x As Integer 
For x = 1 To 100 
With ActivePresentation.Slides(x) 
    If .CustomLayout = .CustomLayout(8) Then 
    Set .CustomLayout = .CustomLayout(12) 
    End If 
End With 
Next x 
End Sub 

편집 : 오류 설명이

내 코드의 문제는 내가 무엇을 내가 RuntimeError에 여기에 438

를 얻을이다

나는 모든 종류의 도움과 건설적인 의견을 정말 기뻐할 것입니다.

EDIT II : 이제 .CustomLayout이 맞춤 레이아웃을 반환합니다. 그러나 나는 어떻게 certrain 슬라이드의 레이아웃을 설정/변경할 수 있습니까? 어떻게해야합니까? 고맙습니다.

EDIT III : 아직 해결책이 없으며 지금 당황하고 있습니다. 너희들은 내가 추측하는 마지막 기회 야. 그래서 여기에 다시 지금 내 코드 :

Dim x As Integer 
For x = 7 To 100 
If ActivePresentation.Slides(x).CustomLayout = ActivePresentation.Designs(1).SlideMaster.CustomLayouts(8) Then ActivePresentation.Slides(x).CustomLayout = ActivePresentation.Designs(1).SlideMaster.CustomLayouts(12) 
End If 
Next x 

나는 여전히 위에서 설명한 런타임 오류가 발생합니다. 어떻게 제거하고 내 코드를 작동시킬 수 있습니까? 대단히 감사합니다! VBA에서는

enter image description here

그들이 ActivePresentation.Designs.SlideMaster 객체를 사용하여 액세스 할 수

+0

당신은 또한 오류 설명을 포함 시겠어요 3 당신이해야 할 이 오류와 관련된 LOC 및 LOC? – PaulFrancis

+0

물론! 내가 독일인 이니까, 나는 독일에서 오류 설명을 얻는다. "개체가이 속성 또는 메서드를 지원하지 않습니다." – Ruben

+0

@Ruben 어떤 버전의 Office를 사용하고 있습니까? – razcor

답변

0

CustomLayout 인터페이스 그들이는, 그쪽이 사용자 레이아웃을 정의하는 것을 목적으로한다.

모든 Slide 개체에는 CustomLayout이 하나만 적용될 수 있으며 CustomLayout 속성을 사용하여 액세스 할 수 있습니다.

CustomLayout을 사용하여 1 CustomLayout 슬라이드를 변경하려는 경우.

ActivePresentation.Slides(1).CustomLayout = ActivePresentation.Designs(1).SlideMaster.CustomLayouts(3) 

참조 : MSDN

그래서, 당신이 만약 블록 comaprison에 이름을 사용해야합니다 코드에 대해서는 :

If ActivePresentation.Slides(x).CustomLayout.Name = ActivePresentation.Designs(1).SlideMaster.CustomLayouts(3).Name Then 
    ActivePresentation.Slides(x).CustomLayout = ActivePresentation.Designs(1).SlideMaster.CustomLayouts(7) 
End If 
관련 문제