Home |
Search |
Today's Posts |
|
#1
![]()
Posted to alt.computer,microsoft.public.excel,microsoft.public.excel.newusers,microsoft.public.excel.printing,microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to alt.computer,microsoft.public.excel,microsoft.public.excel.newusers,microsoft.public.excel.printing,microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to alt.computer,microsoft.public.excel,microsoft.public.excel.newusers,microsoft.public.excel.printing,microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to alt.computer,microsoft.public.excel,microsoft.public.excel.newusers,microsoft.public.excel.printing,microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to alt.computer,microsoft.public.excel,microsoft.public.excel.newusers,microsoft.public.excel.printing,microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to alt.computer,microsoft.public.excel,microsoft.public.excel.newusers,microsoft.public.excel.printing,microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I print an object in Excel 2007 | Excel Discussion (Misc queries) | |||
Print Word Object in Excel | Excel Discussion (Misc queries) | |||
Why does a pasted object in Excel sometimes print upside down? | Excel Discussion (Misc queries) | |||
Print more then one page in excel from a word object | Excel Worksheet Functions |