Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #31   Report Post  
Old February 20th 20, 04:19 AM posted to alt.computer,microsoft.public.excel,microsoft.public.excel.newusers,microsoft.public.excel.printing,microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Dec 2007
Posts: 93
Default Excel print object?

Paul wrote:
Robert Baer wrote:
GS wrote:
* Page breaks will not show in a chart because a chart is "in front"
or overlays cells.

PageBreaks don't show at all; - they reside in the cell where they
are inserted!

** Furthermore, a chart can take a rather large number of cells
(C6..Q38).

** Again, what code is needed to print a chart?

Again, you can't print a chart (or any other object) apart from its
position on the worksheet. *Excel only prints sheet contents in their
respective location on a sheet*

* Not true; easy and simple when done manually:
* 1) Select the chart
* 2) File-- Print
* Done.


https://docs.microsoft.com/en-us/off...mbedded-charts


** Paul

No charts found; cannot work as-is.
If i change the word chart to shape i can find 16 shapes, which is
correct; it is the 4th shape, but one the activate crashes.
Then there is the problem of assigning a name to the print file.
Noodling around on that site was worse than not trying.
Tying the baby bird Goo-Gull,got nowhere.

Once upon a time, in one version of Excel,this worked:
ActivePrinter:="Acrobat PDFWriter", PrintToFile:= True, PrintToFile:=
True, _
PrintOut Copies:= 1, Preview:= False, Collate:= False, _
PrToFilename:=pPath + vNam + ".PDF"

Excel barfs.
Also, i was able to derive the above sequentially, comma to comma or
entry to entry from a pulldown in Excel - i think in edit.

No more; NO help even for ActivePrinter, were i started (i think).

Thanks.

  #32   Report Post  
Old February 20th 20, 05:44 AM posted to alt.computer,microsoft.public.excel,microsoft.public.excel.newusers,microsoft.public.excel.printing,microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Feb 2020
Posts: 5
Default Excel print object?

Robert Baer wrote:
Paul wrote:
Robert Baer wrote:
GS wrote:
* Page breaks will not show in a chart because a chart is "in
front" or overlays cells.

PageBreaks don't show at all; - they reside in the cell where they
are inserted!

Furthermore, a chart can take a rather large number of cells
(C6..Q38).

Again, what code is needed to print a chart?

Again, you can't print a chart (or any other object) apart from its
position on the worksheet. *Excel only prints sheet contents in
their respective location on a sheet*
* Not true; easy and simple when done manually:
1) Select the chart
2) File-- Print
Done.


https://docs.microsoft.com/en-us/off...mbedded-charts


Paul

No charts found; cannot work as-is.
If i change the word chart to shape i can find 16 shapes, which is
correct; it is the 4th shape, but one the activate crashes.
Then there is the problem of assigning a name to the print file.
Noodling around on that site was worse than not trying.
Tying the baby bird Goo-Gull,got nowhere.

Once upon a time, in one version of Excel,this worked:
ActivePrinter:="Acrobat PDFWriter", PrintToFile:= True, PrintToFile:=
True, _
PrintOut Copies:= 1, Preview:= False, Collate:= False, _
PrToFilename:=pPath + vNam + ".PDF"

Excel barfs.
Also, i was able to derive the above sequentially, comma to comma or
entry to entry from a pulldown in Excel - i think in edit.

No more; NO help even for ActivePrinter, were i started (i think).

Thanks.


I tried to set myself up a trial version of Office 2003
to test, but that didn't work. Wouldn't activate.

What if you were to use the menus in Excel, to print the
entire document to PDF. So that you know all the
objects are in the document.

Then, use a PDF editor to re-arrange the content,
removing the parts you don't want.

You could try LibreOffice Draw as a PDF Editor of sorts.
Just print off one page as a test first, and experiment
with that.

Paul

  #33   Report Post  
Old February 21st 20, 07:39 AM posted to alt.computer,microsoft.public.excel,microsoft.public.excel.newusers,microsoft.public.excel.printing,microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Dec 2007
Posts: 93
Default Excel print object?

Paul wrote:
Robert Baer wrote:
Paul wrote:
Robert Baer wrote:
GS wrote:
* Page breaks will not show in a chart because a chart is "in
front" or overlays cells.

PageBreaks don't show at all; - they reside in the cell where they
are inserted!

** Furthermore, a chart can take a rather large number of cells
(C6..Q38).

** Again, what code is needed to print a chart?

Again, you can't print a chart (or any other object) apart from its
position on the worksheet. *Excel only prints sheet contents in
their respective location on a sheet*
* Not true; easy and simple when done manually:
* 1) Select the chart
* 2) File-- Print
* Done.

https://docs.microsoft.com/en-us/off...mbedded-charts


*** Paul

* No charts found; cannot work as-is.
* If i change the word chart to shape i can find 16 shapes, which is
correct; it is the 4th shape, but one the activate crashes.
* Then there is the problem of assigning a name to the print file.
* Noodling around on that site was worse than not trying.
* Tying the baby bird Goo-Gull,got nowhere.

* Once upon a time, in one version of Excel,this worked:
ActivePrinter:="Acrobat PDFWriter", PrintToFile:= True, PrintToFile:=
True, _
PrintOut Copies:= 1, Preview:= False, Collate:= False, _
PrToFilename:=pPath + vNam + ".PDF"

* Excel barfs.
* Also, i was able to derive the above sequentially, comma to comma or
entry to entry from a pulldown in Excel - i think in edit.

* No more; NO help even for ActivePrinter, were i started (i think).

* Thanks.


I tried to set myself up a trial version of Office 2003
to test, but that didn't work. Wouldn't activate.

What if you were to use the menus in Excel, to print the
entire document to PDF. So that you know all the
objects are in the document.

Then, use a PDF editor to re-arrange the content,
removing the parts you don't want.

You could try LibreOffice Draw as a PDF Editor of sorts.
Just print off one page as a test first, and experiment
with that.

** Paul

I certainly do not want to do manual fiddling for each desired result
200 times!
Do not like the idea even for one result.

So far, the best i have squeezed out is initially set Print Area
C12..Q66, use my program to calculate and place shapes in iobj.3, STOP
program, manually file/print/name, then continue so program can then
"erase" the work to restore original inserted picture.

Good for onseies but far from ideal.
Would be VERY nice to have Excel do that manual part.....

Thanks.
  #34   Report Post  
Old February 23rd 20, 10:08 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Aug 2012
Posts: 151
Default Excel print object?

Hi Paul

Just putting it out there, and not even sure this is even relevant here for your issue, but! I ran across this when using code to print charts; coding would only print the charts and not the labels or data series. Apparently Microsoft screwed up on one of their Security Patches KB2596596: https://support.microsoft.com/en-us/...cember-13-2011
https://answers.microsoft.com/en-us/...3-5323489abae9

It would seem nobody within my company had ever used coding for specific printing, hence the reason it was never identified until now.

There was a patch to fix this issue:
http://www.microsoft.com/downloads/d...2-d778db920826

Maybe chat with your IT Dept and see if this is an active issue within your version of office.

The paranoid control freaks in my IT Dept are refusing to apply the fix for little ol' me, because it has global implications for the entire network, blah, blah, go figure!

HTH
Cheers
Mark.

  #35   Report Post  
Old February 26th 20, 06:04 AM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Dec 2007
Posts: 93
Default Excel print object?

Living the Dream wrote:
Hi Paul

Just putting it out there, and not even sure this is even relevant here for your issue, but! I ran across this when using code to print charts; coding would only print the charts and not the labels or data series. Apparently Microsoft screwed up on one of their Security Patches KB2596596: https://support.microsoft.com/en-us/...cember-13-2011
https://answers.microsoft.com/en-us/...3-5323489abae9

It would seem nobody within my company had ever used coding for specific printing, hence the reason it was never identified until now.

There was a patch to fix this issue:
http://www.microsoft.com/downloads/d...2-d778db920826

Maybe chat with your IT Dept and see if this is an active issue within your version of office.

The paranoid control freaks in my IT Dept are refusing to apply the fix for little ol' me, because it has global implications for the entire network, blah, blah, go figure!

HTH
Cheers
Mark.


Me, myself and I constitute "our" IT Dept.
All of us have various versions:
Microsoft Office 2000 Premium (4 disc set)
" " Student and Teacher Edition 2003
" " Student and Teacher Edition 2007
" " Student and Teacher Edition 2010

And as everybody EXCEPT Microsoft knows, the "help" is jusssst enough
to "justify" the label but no more than that.
Never any real-world WORKING examples, just generic useless pablum,
if any at all.
"On Line" is not much better.

NO useful ideas to automate printing of an object to a <path/<file
name supplied by program.file type fixed by programmer.
Everyone and their pet goldfish wants to print cells - which are
BEHIND the object.

Found that if i cheat like hell by Set Print Area to cells in same
place as object, that if i manually then print to manually set
path/filename.filetype, i get reasonably close to what i visibly want.
Note that is not printing the cells per se, just whatever happens to
be in that area.
And then go back to the program, continue it to reset the various
objects and variables to starting state.

At one time, ages ago, the following worked":

ActivePrinter = "Acrobat PDFWriter on FILE:", PrintToFile:= True, _
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=False, _
Collate:=False, PrToFilename:=pPath + vNam + ".PDF"

....and that was incrementally derived by "hints", similar to what Excel
gives on function equations for a cell.



  #36   Report Post  
Old February 26th 20, 04:49 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Apr 2015
Posts: 1,182
Default Excel print object?

At one time, ages ago, the following worked":

ActivePrinter = "Acrobat PDFWriter on FILE:", PrintToFile:= True, _
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=False, _


You could try this if supported...

Sub PrintToFile_XPS(Filename$)
Const sPrinter$ = "Microsoft XPS Document Writer on NE00:" '//edit to actual
port address
ActiveWindow.SelectedSheets.PrintOut _
Copies:=1, ActivePrinter:=sPrinter, _
PrintToFile:=True, PrToFileName:=Filename & ".xps"
End Sub

...or use the FixedFormat feature[s]...

Sub SaveAs_FixedFormat(FileType&, Filename$, _
Settings, Optional FromToRng, _
Optional IsGroup As Boolean = False, _
Optional StampIt As Boolean = True)
' Saves the following via ExportAsFixedFormat:
' Selected sheets, 1 file per sheet;
' Or a specified From/To group of sheets to 1 file,
' Or selected sheets (random grouping) to 1 file;
' Or an entire workbook to 1 file.
'
' ArgsIn:
' FileType& xlTypePDF (0) or xlTypeXSP (1)
' Filename$ Contains "<path\<wkbName" to which each wks.Name is appended
' Settings Array containing the settings for the export params
' IsGroup !
'
Dim wks As Worksheet, sExt$, sFile$, sTS$
If Application.VERSION < 12 Then Exit Sub

sExt = IIf(FileType = 0, ".pdf", ".xps") '//always
sTS = "_" & Format(Now(), "_dd-mm-yyyy_hh-mm_AMPM") '//always

If Not IsGroup Then '//1 file per sheet
For Each wks In ActiveWindow.SelectedSheets
sFile = Filename & "_" & wks.name & IIf(StampIt, sTS & sExt, sExt)
wks.ExportAsFixedFormat Type:=FileType, Filename:=sFile, _
Quality:=Settings(0), IncludeDocProperties:=Settings(1), _
IgnorePrintAreas:=Settings(2), OpenAfterPublish:=Settings(3)
Next 'wks

Else '//multiple sheets per file
sFile = Filename & IIf(StampIt, sTS & sExt, sExt)
If Not IsMissing(FromToRng) Then '//it's a group
If Not LBound(FromToRng) = UBound(FromToRng) Then '//it's From/To
ActiveWorkbook.ExportAsFixedFormat Type:=FileType, Filename:=sFile, _
Quality:=Settings(0), IncludeDocProperties:=Settings(1), _
IgnorePrintAreas:=Settings(2), OpenAfterPublish:=Settings(3), _
From:=FromToRng(0), To:=FromToRng(1)

Else '//it's selected sheets (random grouping)
'ExportAsFixedFormat only works with workbooks/worksheets,
'so copy selected sheets to a new (temp) workbook,
'export it, then discard it.
Application.ScreenUpdating = False '//hide activity
ActiveWindow.SelectedSheets.Copy
With ActiveWorkbook
.ExportAsFixedFormat Type:=FileType, Filename:=sFile, _
Quality:=Settings(0), IncludeDocProperties:=Settings(1), _
IgnorePrintAreas:=Settings(2), OpenAfterPublish:=Settings(3)
.Close SaveChanges:=False
End With 'ActiveWorkbook
Application.ScreenUpdating = True
End If 'Not LBound(FromToRng) = UBound(FromToRng)

Else '//all sheets
ActiveWorkbook.ExportAsFixedFormat Type:=FileType, Filename:=sFile, _
Quality:=Settings(0), IncludeDocProperties:=Settings(1), _
IgnorePrintAreas:=Settings(2), OpenAfterPublish:=Settings(3)
End If 'Not IsMissing(FromToRng)
End If 'Not IsGroup
End Sub 'SaveAs_FixedFormat

Sub Test_SaveAs_FixedFormat()
' Shows the various ways to use the SaveAs_FixedFormat routine.
' How the values passed to it are assembled is up to you!
' This example's focus is on how to prep the args only.

Dim sFile$, rng, vSettings
Const lTypePDF& = 0: Const lTypeXPS& = 1

'ExportAsFixedFormat accepts the following ArgsIn:
' Quality: Standard=0, Minimum=1 (file size)
' IncludeDocProperties: False=0, True=1
' IgnorePrintAreas: False=0, True=1
' OpenAfterPublish: False=0, True=1
'We pass our preferences for these to SaveAs_FixedFormat as a variant array.
vSettings = Split("0,0,0,0", ",") '//edit to suit


'[Construct the Filename according to output path]
'NOTE: Do not include the filename extension
'when using the ExportAsFixedFormat feature.

'If output to ActiveWorkbook.Path, use
'.....................................
sFile = Split(ActiveWorkbook.FullName, ".")(0)
'Edit workbook ref to suit

'If output to a different path, use
'..................................
'Build sFile in logical steps
sFile = "C:\Users\Garry\Documents\VBA_Stuff\" '//path
'Append the filename as per your requirements
sFile = sFile & Split(ActiveWorkbook.name, ".")(0)
'Edit workbook ref to suit


'[Specifying a range of sheets, or a selected sheets grouping]
'................................................. ............
'To Export StartWith/EndWith range of sheets, use
rng = Split("1,2", ",") '//From=rng(0),To=rng(1)
'OR
'To Export a random grouping as selected while pressing 'Ctrl', use
rng = Split("1", ",") '//makes LBound=UBound


'[Exporting scenarios]
'To Export 1 file per selected sheet (random grouping)
SaveAs_FixedFormat FileType:=lTypeXPS, Filename:=sFile, Settings:=vSettings
'OR
SaveAs_FixedFormat FileType:=lTypePDF, Filename:=sFile, Settings:=vSettings


'To Export a From/To range of sheets to 1 file
rng = Split("1,2", ",")
SaveAs_FixedFormat FileType:=lTypeXPS, Filename:=sFile, _
Settings:=vSettings, IsGroup:=True, FromToRng:=rng
'OR
SaveAs_FixedFormat FileType:=lTypePDF, Filename:=sFile, _
Settings:=vSettings, IsGroup:=True, FromToRng:=rng


'To Export selected sheets to 1 file (random grouping)
rng = Split("1", ",")
SaveAs_FixedFormat FileType:=lTypeXPS, Filename:=sFile, _
Settings:=vSettings, IsGroup:=True, FromToRng:=rng
'OR
SaveAs_FixedFormat FileType:=lTypePDF, Filename:=sFile, _
Settings:=vSettings, IsGroup:=True, FromToRng:=rng


'To Export all sheets to 1 file
SaveAs_FixedFormat FileType:=lTypeXPS, Filename:=sFile, _
Settings:=vSettings, IsGroup:=True
'OR
SaveAs_FixedFormat FileType:=lTypePDF, Filename:=sFile, _
Settings:=vSettings, IsGroup:=True
End Sub 'Test_SaveAs_FixedFormat

Sub PrintTo_FixedFormat(FileType&, Filename$, _
Optional NumCopies& = 1, Optional FromToRng, _
Optional IsGroup As Boolean = False, _
Optional StampIt As Boolean = True)
' Prints the following choices via XPS Document Writer OR PDF printer,
' as specified by 'FileType':
' Selected sheets, 1 file per sheet;
' Or a specified From/To range of sheets to 1 file,
' Or selected sheets (random grouping) to 1 file;
' Or an entire workbook to 1 file.
'
' ArgsIn:
' FileType& lTypePDF=0; lTypeXPS=1
' Filename Contains "<path\<wkbName"
' NumCopies !
' IsGroup !
'
Dim wks As Worksheet, sExt$, sFile$, sStamp$
Dim sPrinter$, sDfltPrn$

Const sPrnXPS$ = "Microsoft XPS Document Writer on NE00:"
Const sPrnPDF$ = "deskPDF on DDM:"
'To quickly find the port your 'FileType' printer uses,
' - change the printer in the Print dialog and close without printing;
' - in the VBE Immediate Window type the following, then press 'Enter';
' ?activeprinter
' - reset the printer in the Print dialog to your default!

'Initialize essential vars
sDfltPrn = Application.ActivePrinter '//reset when done
sPrinter = IIf(FileType = 0, sPrnPDF, sPrnXPS)
sExt = IIf(FileType = 0, ".pdf", ".xps")
sStamp = "_" & Format(Now(), "dd-mm-yyyy_hh-mm_AMPM")

If Not IsGroup Then '//1 file per sheet
For Each wks In ActiveWindow.SelectedSheets
sFile = Filename & "_" & wks.name & IIf(StampIt, sStamp & sExt, sExt)
wks.PrintOut ActivePrinter:=sPrinter, Copies:=NumCopies, _
PrintToFile:=True, PrToFileName:=sFile
Next 'wks

Else
sFile = Filename & IIf(StampIt, sStamp & sExt, sExt)
If Not IsMissing(FromToRng) Then '//it's a range
If Not LBound(FromToRng) = UBound(FromToRng) Then
ActiveWorkbook.PrintOut From:=CLng(FromToRng(0)),
To:=CLng(FromToRng(1)), _
ActivePrinter:=sPrinter, Copies:=NumCopies, PrintToFile:=True,
PrToFileName:=sFile

Else '//it's a random grouping
ActiveWindow.SelectedSheets.PrintOut ActivePrinter:=sPrinter, _
Copies:=NumCopies, PrintToFile:=True, PrToFileName:=sFile
End If 'Not LBound(FromToRng) = UBound(FromToRng)

Else
ActiveWorkbook.PrintOut ActivePrinter:=sPrinter, Copies:=NumCopies, _
PrintToFile:=True, PrToFileName:=sFile
End If 'Not IsMissing(FromToRng)
End If 'Not IsGroup

Application.ActivePrinter = sDfltPrn
End Sub 'PrintTo_FixedFormat

Sub Test_PrintTo_FixedFormat()
' Shows the various ways to use the PrintTo_FixedFormat routine.
' How the values passed to it are assembled is up to you!
' This example's focus is on how to prep the args only.

Dim sFile$, rng
Const lTypePDF& = 0: Const lTypeXPS& = 1

'[Construct the Filename according to output path]
'NOTE: Do not include the filename extension
'when using an XPS Document Writer.

'If output to ActiveWorkbook.Path, use
'.....................................
sFile = Split(ActiveWorkbook.FullName, ".")(0)
'Edit workbook ref to suit

'If output to a different path, use
'..................................
'Build sFile in logical steps
sFile = "C:\Users\Garry\Documents\VBA_Stuff\" '//path
'Append the filename as per your requirements
sFile = sFile & Split(ActiveWorkbook.name, ".")(0)
'Edit workbook ref to suit


'[Specifying a range of sheets, or a selected sheets grouping]
'................................................. ............
'To print StartWith/EndWith range of sheets, use
rng = Split("1,2", ",") '//From=rng(0),To=rng(1)
'OR
'To print a random grouping as selected while pressing 'Ctrl', use
rng = Split("1", ",") '//makes LBound=UBound


'[Printing scenarios]
'To print 1 file per selected sheet (random grouping)
PrintTo_FixedFormat FileType:=lTypeXPS, Filename:=sFile
'OR
PrintTo_FixedFormat FileType:=lTypePDF, Filename:=sFile


'To print a From/To range of sheets to 1 file
rng = Split("1,2", ",")
PrintTo_FixedFormat FileType:=lTypeXPS, Filename:=sFile, IsGroup:=True,
FromToRng:=rng
'OR
PrintTo_FixedFormat FileType:=lTypePDF, Filename:=sFile, IsGroup:=True,
FromToRng:=rng


'To print selected sheets to 1 file (random grouping)
rng = Split("1", ",")
PrintTo_FixedFormat FileType:=lTypeXPS, Filename:=sFile, IsGroup:=True,
FromToRng:=rng
'OR
PrintTo_FixedFormat FileType:=lTypePDF, Filename:=sFile, IsGroup:=True,
FromToRng:=rng


'To print all sheets to 1 file
PrintTo_FixedFormat FileType:=lTypeXPS, Filename:=sFile, IsGroup:=True
'OR
PrintTo_FixedFormat FileType:=lTypePDF, Filename:=sFile, IsGroup:=True
End Sub 'Test_PrintTo_FixedFormat

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


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 11:55 AM.

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

About Us

"It's about Microsoft Excel"

 

Copyright © 2017