Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to alt.computer,microsoft.public.excel,microsoft.public.excel.newusers,microsoft.public.excel.printing,microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Excel print object?

Snippet of incomplete program:
*COPY*
ActivePrinter = "Acrobat PDFWriter on FILE:": PrintToFile = True
'note need KILL statement for PDFWriter
' Above sets printer in Excel 2003; WILL crash in Excel 2010.

num = 1 'here we try to select the diagram only; hope printer will
use that
For Each iobj In ActiveSheet.Shapes 'DrawingObjects
iobj.Select
If num = 5 Then
Exit For 'got inserted "Picture 3"; want to print only this
End If
num = num + 1
Next iobj
' So..how do we pass it on?

' In "modern" defective Excel 2010, prints to default SO must set
default to what is needed
' ActivePrinter = "Xerox Phaser 6120 PS on FILE:": PrintToFile = True
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=False, _
Collate:=False, PrToFilename:=pPath + vNam 'use + ".PS" for Xerox
printer
Kill pPath + vNam 'not needed for PS printer
*END COPY*

So..how do we pass it on or select it or whatever for printing?

Thanks
  #2   Report Post  
Posted to alt.computer,microsoft.public.excel,microsoft.public.excel.newusers,microsoft.public.excel.printing,microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Excel print object?

Robert Baer wrote:
Snippet of incomplete program:
*COPY*
ActivePrinter = "Acrobat PDFWriter on FILE:": PrintToFile = True
'note need KILL statement for PDFWriter
' Above sets printer in Excel 2003; WILL crash in Excel 2010.

num = 1 'here we try to select the diagram only; hope printer will
use that
For Each iobj In ActiveSheet.Shapes 'DrawingObjects
iobj.Select
If num = 5 Then
Exit For 'got inserted "Picture 3"; want to print only this
End If
num = num + 1
Next iobj
' So..how do we pass it on?

' In "modern" defective Excel 2010, prints to default SO must set
default to what is needed
' ActivePrinter = "Xerox Phaser 6120 PS on FILE:": PrintToFile = True
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=False, _
Collate:=False, PrToFilename:=pPath + vNam 'use + ".PS" for Xerox
printer
Kill pPath + vNam 'not needed for PS printer
*END COPY*

So..how do we pass it on or select it or whatever for printing?

Thanks


Did you go looking for example code ?

https://stackoverflow.com/questions/...ting-excel-vba

They present an overview of sorts about .select here.

Note that the HTML formatting applied here, may require you
to test multiple browsers to get a copy clean enough to read.
Seamonkey = screwy, Chromealike = OK.

https://stackoverflow.com/questions/...excel-vba?rq=1

Paul
  #3   Report Post  
Posted to alt.computer,microsoft.public.excel,microsoft.public.excel.newusers,microsoft.public.excel.printing,microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Excel print object?

Paul wrote:
Robert Baer wrote:
Â* Snippet of incomplete program:
*COPY*
Â*Â*Â* ActivePrinter = "Acrobat PDFWriter on FILE:": PrintToFile = True
'note need KILL statement for PDFWriter
' Above sets printer in Excel 2003; WILL crash in Excel 2010.

Â*num = 1Â*Â*Â* 'here we try to select the diagram only; hope printer will
use that
Â*For Each iobj In ActiveSheet.ShapesÂ*Â*Â* 'DrawingObjects
Â* iobj.Select
Â* If num = 5 Then
Â*Â* Exit ForÂ*Â* 'got inserted "Picture 3"; want to print only this
Â* End If
Â* num = num + 1
Â*Next iobj
Â*'Â* So..how do we pass it on?

' In "modern" defective Excel 2010, prints to default SO must set
default to what is needed
'Â*Â*Â* ActivePrinter = "Xerox Phaser 6120 PS on FILE:": PrintToFile = True
Â*Â*Â* ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=False, _
Â*Â*Â* Collate:=False, PrToFilename:=pPath + vNamÂ* 'use + ".PS" for Xerox
printer
Â*Â*Â* Kill pPath + vNamÂ*Â* 'not needed for PS printer
*END COPY*

Â* So..how do we pass it on or select it or whatever for printing?

Â*Â* Thanks


Did you go looking for example code ?

https://stackoverflow.com/questions/...ting-excel-vba


They present an overview of sorts about .select here.

Note that the HTML formatting applied here, may require you
to test multiple browsers to get a copy clean enough to read.
Seamonkey = screwy, Chromealike = OK.

https://stackoverflow.com/questions/...excel-vba?rq=1


Â*Â* Paul

Well, i looked at those and others.
Everybody refers to ranges or cells or sheets or ...
BUT not at an actual object.
Using fake code, iobj.5 is also known as "Picture 3", which was
inserted from an external source.
The For Each iobj loop was the only way i discovered how to get at it.
I want to print it after i made changes by moving other objects into
and out of it.

Thanks
  #4   Report Post  
Posted to alt.computer,microsoft.public.excel,microsoft.public.excel.newusers,microsoft.public.excel.printing,microsoft.public.excel.programming
external usenet poster
 
Posts: 1,182
Default Excel print object?

Well, i looked at those and others.
Everybody refers to ranges or cells or sheets or ...
BUT not at an actual object.
Using fake code, iobj.5 is also known as "Picture 3", which was inserted
from an external source.
The For Each iobj loop was the only way i discovered how to get at it.
I want to print it after i made changes by moving other objects into and
out of it.


When I modify/markup an image in Excel I take a ScreenCapture of it and convert
that to whatever image format I'm after. Since this is the only contents on a
worksheet, the normal Print processes work as expected for printing the
finished result.

Normally, I set the sheet up like graph paper and turn Gridlines off.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
  #5   Report Post  
Posted to alt.computer,microsoft.public.excel,microsoft.public.excel.newusers,microsoft.public.excel.printing,microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Excel print object?

GS wrote:
* Well, i looked at those and others.
** Everybody refers to ranges or cells or sheets or ...
** BUT not at an actual object.
** Using fake code, iobj.5 is also known as "Picture 3", which was
inserted from an external source.
** The For Each iobj loop was the only way i discovered how to get at it.
** I want to print it after i made changes by moving other objects
into and out of it.


When I modify/markup an image in Excel I take a ScreenCapture of it and
convert that to whatever image format I'm after. Since this is the only
contents on a worksheet, the normal Print processes work as expected for
printing the finished result.

Normally, I set the sheet up like graph paper and turn Gridlines off.

I have a loop around the basic generator to produce 200 patterns that
i want to save, and using a PDF printer to FILE: allows the computer to
do all of the work (like it should do).

Even for one pass, I cannot get it to print that object; so the
normal Print processes does NOT work properly; it prints the whole page.

Your last line indicates that you refer to sheets (like i said), not
an object/picture.

The For Each iobj loop selects the desired object(picture); how do i
complete the process to print it?

Thanks.





  #6   Report Post  
Posted to alt.computer,microsoft.public.excel,microsoft.public.excel.newusers,microsoft.public.excel.printing,microsoft.public.excel.programming
external usenet poster
 
Posts: 1,182
Default Excel print object?

GS wrote:
* Well, i looked at those and others.
** Everybody refers to ranges or cells or sheets or ...
** BUT not at an actual object.
** Using fake code, iobj.5 is also known as "Picture 3", which was
inserted from an external source.
** The For Each iobj loop was the only way i discovered how to get at it.
** I want to print it after i made changes by moving other objects into
and out of it.


When I modify/markup an image in Excel I take a ScreenCapture of it and
convert that to whatever image format I'm after. Since this is the only
contents on a worksheet, the normal Print processes work as expected for
printing the finished result.

Normally, I set the sheet up like graph paper and turn Gridlines off.

I have a loop around the basic generator to produce 200 patterns that i
want to save, and using a PDF printer to FILE: allows the computer to do all
of the work (like it should do).

Even for one pass, I cannot get it to print that object; so the normal
Print processes does NOT work properly; it prints the whole page.

Your last line indicates that you refer to sheets (like i said), not an
object/picture.

The For Each iobj loop selects the desired object(picture); how do i
complete the process to print it?

Thanks.


I ScreenCapture, as I said, then convert to the image format I want. There is
only 1 image per page, so if you want individual printouts then Insert
PageBreak after each image.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Excel print object?

Hi Robert,

Am Fri, 7 Feb 2020 00:01:05 -0800 schrieb Robert Baer:

Snippet of incomplete program:
*COPY*
ActivePrinter = "Acrobat PDFWriter on FILE:": PrintToFile = True
'note need KILL statement for PDFWriter
' Above sets printer in Excel 2003; WILL crash in Excel 2010.


only workbook, worksheets, sheet ranges and charts can be exported to
PDF.

Try:

Sub PrintShapes()
Dim shp As Shape
Dim i As Integer
Dim varShp() As Variant

'Modify here the path to save the pdf
Const myPath = "C:\Users\claus\Desktop\"
With Application
.ScreenUpdating = False
.DisplayAlerts = False
End With
'Modify the sheet name
With Sheets("Sheet1")
For Each shp In .Shapes
ReDim Preserve varShp(i)
varShp(i) = shp.Name
i = i + 1
Next

Sheets.Add after:=Sheets(Sheets.Count)
ActiveSheet.Name = "Temp"

For i = LBound(varShp) To UBound(varShp)
With Charts.Add
.SetSourceData Source:=Sheets("Temp").Range("A1")
.Location whe=xlLocationAsObject, Name:=Sheets("Temp").Name
End With
.Shapes(varShp(i)).Copy
Sheets("Temp").ChartObjects(1).Chart.Paste
With Sheets("Temp").Shapes(1)
.Height = Sheets("Sheet1").Shapes(varShp(i)).Height + 1
.Width = Sheets("Sheet1").Shapes(varShp(i)).Width + 1
End With

Sheets("Temp").ChartObjects(1).Chart.ExportAsFixed Format Type:=xlTypePDF, Filename:= _
myPath & varShp(i) & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
False
Sheets("Temp").ChartObjects(1).Delete
Next
Sheets("Temp").Delete
End With
With Application
.ScreenUpdating = True
.DisplayAlerts = True
End With
End Sub


Regards
Claus B.
--
Windows10
Office 2016
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Excel print object?

Claus Busch wrote:
Hi Robert,

Am Fri, 7 Feb 2020 00:01:05 -0800 schrieb Robert Baer:

Snippet of incomplete program:
*COPY*
ActivePrinter = "Acrobat PDFWriter on FILE:": PrintToFile = True
'note need KILL statement for PDFWriter
' Above sets printer in Excel 2003; WILL crash in Excel 2010.


only workbook, worksheets, sheet ranges and charts can be exported to
PDF.

Try:

Sub PrintShapes()
Dim shp As Shape
Dim i As Integer
Dim varShp() As Variant

'Modify here the path to save the pdf
Const myPath = "C:\Users\claus\Desktop\"
With Application
.ScreenUpdating = False
.DisplayAlerts = False
End With
'Modify the sheet name
With Sheets("Sheet1")
For Each shp In .Shapes
ReDim Preserve varShp(i)
varShp(i) = shp.Name
i = i + 1
Next

Sheets.Add after:=Sheets(Sheets.Count)
ActiveSheet.Name = "Temp"

For i = LBound(varShp) To UBound(varShp)
With Charts.Add
.SetSourceData Source:=Sheets("Temp").Range("A1")
.Location whe=xlLocationAsObject, Name:=Sheets("Temp").Name
End With
.Shapes(varShp(i)).Copy
Sheets("Temp").ChartObjects(1).Chart.Paste
With Sheets("Temp").Shapes(1)
.Height = Sheets("Sheet1").Shapes(varShp(i)).Height + 1
.Width = Sheets("Sheet1").Shapes(varShp(i)).Width + 1
End With

Sheets("Temp").ChartObjects(1).Chart.ExportAsFixed Format Type:=xlTypePDF, Filename:= _
myPath & varShp(i) & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
False
Sheets("Temp").ChartObjects(1).Delete
Next
Sheets("Temp").Delete
End With
With Application
.ScreenUpdating = True
.DisplayAlerts = True
End With
End Sub


Regards
Claus B.

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..

Thanks.


  #9   Report Post  
Posted to microsoft.public.excel.programming
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
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Excel print object?

Claus Busch wrote:
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.

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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I print an object in Excel 2007 MAF Excel Discussion (Misc queries) 2 April 4th 09 03:40 AM
Print Word Object in Excel Mac Excel Discussion (Misc queries) 7 March 2nd 07 05:12 PM
Why does a pasted object in Excel sometimes print upside down? Mel Excel Discussion (Misc queries) 2 December 2nd 05 02:07 PM
Print more then one page in excel from a word object Alex Martinez Excel Worksheet Functions 0 October 14th 05 06:22 AM


All times are GMT +1. The time now is 04:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"