Forum Discussion
Goinsbunch Goins
Jul 13, 2018Copper Contributor
Print Camera Object on Whole Page, Without Bleed Over
I have a camera object that you can see in the Pre Print Image. I need this to be printed it's on page if the data above it pushes it to bleed over onto the next page. I've googled/se...
Goinsbunch Goins
Jul 14, 2018Copper Contributor
Thanks Man for responding.
Presently I am using a macro that prints the two worksheets needed, which always puts the data from the camera object into a new page. While this works perfect sometimes (a census between 109-131 or over 151 patients), anything in between wastes an entire page. Hence having to cut and tape the table to the bottom of the 3rd or 4th page in those scenarios.
I have toyed around with editing the macro to print the camera object when there is <108,131>151 patients and printing it as two separate worksheet otherwise. But the coding is too cumbersome for my novice abilities to translate from the sites I've read online.
For now it seems like scissors and tape... Any other ideas?
Presently I am using a macro that prints the two worksheets needed, which always puts the data from the camera object into a new page. While this works perfect sometimes (a census between 109-131 or over 151 patients), anything in between wastes an entire page. Hence having to cut and tape the table to the bottom of the 3rd or 4th page in those scenarios.
I have toyed around with editing the macro to print the camera object when there is <108,131>151 patients and printing it as two separate worksheet otherwise. But the coding is too cumbersome for my novice abilities to translate from the sites I've read online.
For now it seems like scissors and tape... Any other ideas?
Man Fai Chan
Jul 14, 2018Iron Contributor
I prepared the following code:
Sub Move_Photo()
n = Val(InputBox("Input number of rows in front of the photo"))
Set RS = Sheets.Add
For i = 1 To n
RS.Cells(i, 1) = i
j = i Mod 4 + 3
RS.Cells(i, j) = "Data " & i
Next i
' Inserting data rows
' Not useful in the program
' Just to show the user that there are n row in front of the inserted photo
Sheets("Sheet1").Select
Sheets("Sheet1").Shapes.Range(Array("Inserted Photo")).Select
Selection.Copy
RS.Select
RS.HPageBreaks.Add before:=Cells(n + 1, 1)
' Inserting a horizontal page break
RS.Range("A" & n + 1).Select
RS.Paste
End Sub
You may download the file and import the code into it. Hope that it inspires you the way to insert horizontal pagebreak.
- Goinsbunch GoinsJul 14, 2018Copper ContributorWill give it a go here in the next few hours and tell you how it works! Thanks again!
- Goinsbunch GoinsJul 14, 2018Copper Contributor
Ok, so figured it out, you gave me some ideas, so I appreciate it.
Sub PrintEntireList()
n = Worksheets("Patient List Report").Range("O7").Value
Application.Goto ThisWorkbook.Sheets("Patient List Report").Range("A1"), True
ActiveSheet.AutoFilterMode = False ' Reset Report Filter
ActiveSheet.Range("$A$1:$M$250").AutoFilter Field:=12, Criteria1:="FALSE" ' Filter for false results
If n > 106 And n < 130 Or n > 149 And < 173 Then
ActiveSheet.PageSetup.PrintArea = "$A$1:$K$200"
Worksheets(Array("Patient List Report", "Daily Count Sheet")).PrintOut preview:=True
Else
ActiveSheet.PageSetup.PrintArea = "$A$1:$K$233"
Worksheets("Patient List Report").PrintOut preview:=True
End If
'Go Back To Patient List Report
Application.Goto ThisWorkbook.Sheets("Patient List Report").Range("A1"), True
ActiveSheet.Range("$A$1:$M$210").AutoFilter Field:=12
End SubI have a helper cell that is calculating the number of true patients I have in the list, and carefully evaluated at what rows the camera object was bleeding over into the next page. Hence I got the numbers above. Finally I set the Camera Object at the edge of the main print/filter area and adjusted it to include the camera object when the entire image would fit on the page.