Push a picture to the next page if it gets inserted over the page break so half is one page and half is on the next

dpaton05

Well-known Member
Joined
Aug 14, 2018
Messages
2,343
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
On my spreadsheet, there are 2 buttons and below them I have a textbox that has notes entered in it. One button inserts a signature that is stored on another sheet and the other button allows for the entry of a custom signature. The image on the signature is inserted just below the bottom of the text box. The sub to insert the signature works fine except that if notes have been added to the textbox so there is only enough room to enter part of the signature on the current page and the rest on the page below it, the signature will be split.

The textbox is called textbox4.

The code to enter the signature stored in another sheet is
VBA Code:
Sub cmdGarrettSig()
    Dim shp As Shape
    Set shp = ActiveSheet.Shapes("textbox4")
        Sheets("Sheet2").Shapes("ImgG").Copy
        ActiveSheet.Paste Destination:=ActiveSheet.Cells(1, 1)
        Selection.Top = shp.Top + shp.Height + "50"

End Sub

The code to enter the custom signature is
VBA Code:
Sub cmdCustomSig()
Dim fNameAndPath As Variant
Dim img As Picture, shp As Shape
Set shp = ThisWorkbook.Worksheets("quote_sheet").Shapes("textbox4")

fNameAndPath = Application.GetOpenFilename(Title:="Select Picture To Be Imported")
If fNameAndPath = False Then Exit Sub
    Set img = Worksheets("quote_sheet").Pictures.Insert(fNameAndPath)
    With img
       .Top = shp.Top + shp.Height + "50"
       .Left = "0"
    End With
End Sub

Could someone help me change the code so the image of the signatures does not get split if it lies across a page break, half on one page and half on the next but is pushed down to the following page below if that happens please?
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,147,499
Messages
5,741,511
Members
423,663
Latest member
kaveh87rsh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top