I have a script to convert excel to power point as image
Sub tempel()
Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
Dim SlideCount As Long
Dim banyakhal
Dim i, temp, temp1
Dim m, n
Dim lokasi
Dim batas
Dim barisakhir
' Reference existing instance of PowerPoint
Set PPApp = GetObject(, "Powerpoint.Application")
' Reference active presentation
Set PPPres = PPApp.ActivePresentation
' Some PowerPoint actions work best in normal slide view
PPApp.ActiveWindow.ViewType = ppViewSlide
' Reference active slide
Set PPSlide = PPPres.Slides _
(PPApp.ActiveWindow.Selection.SlideRange.SlideIndex)
''---------------------
'' Di sini masalahnya
'' bagaimana memilih perhalaman
'' kita coba
''---------------------
banyakhal = ActiveSheet.HPageBreaks.Count
'kalau cuma satu halaman
If banyakhal = 0 Then
lokasi = ActiveSheet.PageSetup.PrintArea
Range(lokasi).Select
Selection.CopyPicture Appearance:=xlPrinter, Format:=xlPicture
SlideCount = PPPres.Slides.Count
Set PPSlide = PPPres.Slides.Add(SlideCount + 1, ppLayoutTitleOnly)
PPApp.ActiveWindow.View.GotoSlide PPSlide.SlideIndex
PPApp.ActiveWindow.Selection.SlideRange.Layout = ppLayoutBlank
PPApp.ActiveWindow.View.Paste
With PPApp.ActiveWindow.Selection.ShapeRange
.Fill.Transparency = 0#
.Width = 720#
End With
With PPApp.ActiveWindow.Selection.ShapeRange
.Fill.Transparency = 0#
.Left = 0#
.Top = 0#
End With
Else
For i = 1 To banyakhal + 1
'hal pertama
If i = 1 Then
temp = ActiveSheet.HPageBreaks(i).Location.Row
Range("A1:L" & (temp - 1)).Select
End If
'hal tengah
If ((i <= banyakhal) And (i > 1)) Then
m = ActiveSheet.HPageBreaks((i - 1)).Location.Row
n = ActiveSheet.HPageBreaks(i).Location.Row
batas = "A" & (m) & ":L" & (n - 1)
Range(batas).Select
End If
'hal terakhir
If i > banyakhal Then
barisakhir = Split(ActiveSheet.PageSetup.PrintArea, "$")
n = barisakhir(4)
m = ActiveSheet.HPageBreaks(i - 1).Location.Row
batas = "A" & (m) & ":L" & (n)
Range(batas).Select
End If
Selection.CopyPicture Appearance:=xlPrinter, Format:=xlPicture
SlideCount = PPPres.Slides.Count
Set PPSlide = PPPres.Slides.Add(SlideCount + 1, ppLayoutTitleOnly)
PPApp.ActiveWindow.View.GotoSlide PPSlide.SlideIndex
PPApp.ActiveWindow.Selection.SlideRange.Layout = ppLayoutBlank
PPApp.ActiveWindow.View.Paste
With PPApp.ActiveWindow.Selection.ShapeRange
.Fill.Transparency = 0#
.Width = 720#
End With
If i = 1 Then
With PPApp.ActiveWindow.Selection.ShapeRange
.Fill.Transparency = 0#
.Left = 0#
.Top = 0#
End With
Else
With PPApp.ActiveWindow.Selection.ShapeRange
.Fill.Transparency = 0#
.Left = 0#
.Top = 25#
End With
'tempel judul
Range("A4:L5").Select
Selection.CopyPicture Appearance:=xlPrinter, Format:=xlPicture
PPApp.ActiveWindow.View.Paste
With PPApp.ActiveWindow.Selection.ShapeRange
.Fill.Transparency = 0#
.Width = 720#
End With
With PPApp.ActiveWindow.Selection.ShapeRange
.Fill.Transparency = 0#
.Left = 0#
.Top = 0#
End With
End If
Next i
End If
' Save the presentation
' Clean up
Set PPSlide = Nothing
Set PPPres = Nothing
Set PPApp = Nothing
End Sub
any suggest?
thanks
Bookmarks