2017-02-01 2 views
1

Excel에서 차트를 PowerPoint로 붙여 넣을 수있는 VBA 매크로가 있는데이 방법이 효과적입니다.Excel에서 PowerPoint로 글꼴 서식 유지

PowerPoint로 동일한 워크 시트의 특정 셀의 셀 내용을 복사하도록 매크로를 조정했습니다. 매크로를 복사하기 전에 PowerPoint 서식 파일 에서처럼 글꼴 크기를 Excel에서 동일하게 설정하더라도 (40 포인트 모두) 글꼴은 매크로 실행 전에 Excel에서 설정 한 40 점이 아닌 18 점에 붙여 넣습니다. .

'Opens a new PowerPoint presentation based on template and pastes data into Slide 2 of Powerpoint from Excel 

Dim PPApp As PowerPoint.Application, PPPres As PowerPoint.Presentation, PPSlide As PowerPoint.Slide, PPShape As Object, PPChart As Object 

Dim XLws As Worksheet 

Set XLws = ActiveSheet 
Set PPApp = New PowerPoint.Application 
Set PPPres = PPApp.Presentations.Open("C:\Users\Colin\Dropbox (Edge45)\Edge45 Team Folder\Edge45 Company Documents\Templates\Powerpoint Templates\Edge45 Monthly Report Template Macro.potm", Untitled:=msoTrue) 
PPApp.Visible = True 
Set PPSlide = PPPres.Slides(12) 

XLws.ChartObjects(1).Copy ' or XLws.ChartObjects("Chart 2").Copy 
Set PPChart = PPSlide.Shapes.PasteSpecial(DataType:=ppPasteDefault) 

With PPChart 

.Left = 18 
.Height = 322 
.Top = 121 
.Width = 531 

End With 

'Copies Contents of Cells Q36 and R36 in excel worksheet and pastes as text into slide 13 of presentation 
    XLws.Range("Q36:R36").Copy 
    Set PPChart = PPSlide.Shapes.PasteSpecial(DataType:=ppPasteDefault) 

Set PPSlide = PPPres.Slides(13) 
+0

무엇 붙여 넣기에 대해 이미지/그림으로? – Namkce

+0

네, 그렇게 해 드리겠습니다. 먼저 내부 경계선을 지정하지 않았는데도 두 셀 사이에 줄 분할이 포함되어 있습니다. 둘째, 복사중인 텍스트에 그림자를 넣고 싶습니다. 그 이미지 붙여 넣기에서 그렇게 행복하게! – Superhans

+0

XLws.Range ("Q36 : R36")의 데이터를 붙여 넣기 전에 슬라이드 13로 PPSlide를 설정하지 않아도됩니까? – mooseman

답변

0

콜린,

당신은 당신이 그것을 다시 복사 한 후 글꼴 크기를 변경을 다음과 같이이 모든 것을 처리

코드는 무엇입니까? 어쩌면 자동으로 링크/업데이트됩니다.

수동으로 좀 더 정확하게 무슨 일을 모방하기 위해 다음 포스트에서 참조 ExecuteMso 명령을 사용하는 것이 좋습니다하려는 붙여 넣기 옵션 중 하나를 사용하여 복사 할 수있는 경우 :

How to copy a chart from Excel to PowerPoint?

관련 문제