View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Excel print object?

Hi Robert,

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


Interesting.
(thinking out loud)..my iobj is IN a sheet..it 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
Next

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
Next
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
Next
c.Resize(iRow, iCol).ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
myPath & varShp(i) & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
False
Next
End With
End Sub


Regards
Claus B.
--
Windows10
Office 2016