View Single Post
  #13   Report Post  
Old February 12th 20, 07:26 AM posted to microsoft.public.excel.programming
Robert Baer Robert Baer is offline
external usenet poster
First recorded activity by ExcelBanter: Dec 2007
Posts: 93
Default Excel print object?

Claus Busch wrote:
Hi Robert,

Am Mon, 10 Feb 2020 23:50:09 -0800 schrieb Robert Baer:

(thinking out loud) iobj is IN a is NOT a ChartObject
or related to a chart in any way that i know of..maybe it can be
considered as a Shape.
So, perhaps there is a chance of part of above working..

another idea:

Sub ShapesToPDF()
Dim c As Range
Dim shp As Shape
Dim varShp() As Variant
Dim i As Integer, iRow As Integer, iCol As Integer

'Modify the path for the PDFs
Const myPath = "C:\Users\claus\Desktop\"

With ActiveSheet
For Each shp In .Shapes
ReDim Preserve varShp(i)
varShp(i) = shp.Name
i = i + 1

For i = LBound(varShp) To UBound(varShp)
Set c = .Shapes(varShp(i)).TopLeftCell
For iRow = 2 To 30
With .Shapes(varShp(i))
If c.Resize(iRow).Top + c.Resize(iRow).Height .Top + _
.Height Then
Exit For
End If
End With
For iCol = 2 To 20
With .Shapes(varShp(i))
If c.Resize(, iCol).Left + c.Resize(, iCol).Width
.Left + _
.Width Then
Exit For
End If
End With
c.Resize(iRow, iCol).ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
myPath & varShp(i) & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
End With
End Sub

Claus B.

Will try your suggestions when i have the time; got too many irons
and only one fire.