Xin chào các bạn, anh, chi
hiện mình muốn thay đổi kích thước của chart trong excel, rồi từ đó copy vào trong powerpoint.
e có sử dụng đoạn mã từ Microsoft
'tao 1 powerpoint.
Dim oPPTApp As PowerPoint.Application
Dim oPPSlide As PowerPoint.Slide
Dim oPPTShape As PowerPoint.Shape
Dim oPPTObj As Object
Dim oPPTFile As PowerPoint.Presentation
Dim SlideNum As Integer
Sub modExcelToPowerPoint()
Dim FilePath As String
FilePath = "E:\123.pptx"
Set oPPTApp = CreateObject("PowerPoint.Application")
oPPTApp.Visible = msoTrue
Set oPPTFile = oPPTApp.Presentations.Open(FilePath)
SlideNum = 1
oPPTFile.Slides(SlideNum).Select
'(slide 2 ÀÛ¼º) -----------------------------------------------------
'copy 1 chart co ten v1,
'pase vao powerpoint
Worksheets("sheet1").ChartObjects("v1").CopyPicture
Set oPPTShape = oPPTApp.ActivePresentation.Slides(2).Shapes.Paste(1)
With oPPTShape
.Left = 23 'e nghĩ đây là quy định vị trí của shape
.Top = 55.8
.Height = 300 'quy dinh chieu cao cua shape ?
.Width = 500
.ZOrder msoSendToBack
End With
Worksheets("sheet1").ChartObjects("v2").CopyPicture
Set oPPTShape = oPPTApp.ActivePresentation.Slides(2).Shapes.Paste(1)
With oPPTShape
.Left = 23
.Top = 55.8
.Height = 300 ' 2 chart co quy dinh giong het nhau, nhung khi vao power thi co 2 shape khac nhau ve kich thuoc.
.Width = 500
.ZOrder msoSendToBack
End With
End Sub
Ai biết thì giúp mình với.
thanks so much.
hiện mình muốn thay đổi kích thước của chart trong excel, rồi từ đó copy vào trong powerpoint.
e có sử dụng đoạn mã từ Microsoft
'tao 1 powerpoint.
Dim oPPTApp As PowerPoint.Application
Dim oPPSlide As PowerPoint.Slide
Dim oPPTShape As PowerPoint.Shape
Dim oPPTObj As Object
Dim oPPTFile As PowerPoint.Presentation
Dim SlideNum As Integer
Sub modExcelToPowerPoint()
Dim FilePath As String
FilePath = "E:\123.pptx"
Set oPPTApp = CreateObject("PowerPoint.Application")
oPPTApp.Visible = msoTrue
Set oPPTFile = oPPTApp.Presentations.Open(FilePath)
SlideNum = 1
oPPTFile.Slides(SlideNum).Select
'(slide 2 ÀÛ¼º) -----------------------------------------------------
'copy 1 chart co ten v1,
'pase vao powerpoint
Worksheets("sheet1").ChartObjects("v1").CopyPicture
Set oPPTShape = oPPTApp.ActivePresentation.Slides(2).Shapes.Paste(1)
With oPPTShape
.Left = 23 'e nghĩ đây là quy định vị trí của shape
.Top = 55.8
.Height = 300 'quy dinh chieu cao cua shape ?
.Width = 500
.ZOrder msoSendToBack
End With
Worksheets("sheet1").ChartObjects("v2").CopyPicture
Set oPPTShape = oPPTApp.ActivePresentation.Slides(2).Shapes.Paste(1)
With oPPTShape
.Left = 23
.Top = 55.8
.Height = 300 ' 2 chart co quy dinh giong het nhau, nhung khi vao power thi co 2 shape khac nhau ve kich thuoc.
.Width = 500
.ZOrder msoSendToBack
End With
End Sub
Ai biết thì giúp mình với.
thanks so much.

