VBA to insert a custom image

dpaton05

Well-known Member
Joined
Aug 14, 2018
Messages
2,375
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have code to insert a set image. Could someone tell me how to alter it so it can insert a custom image please?

Code:
Sub cmdJakeSig()
    Dim shp As Shape
    Set shp = ThisWorkbook.Worksheets("sheet1").Shapes("textbox4")
        Sheets("Sheet2").Shapes("ImgJ").Copy
        Sheets("sheet1").Paste Destination:=Sheets("sheet1").Cells(1, 1)
        Selection.Top = shp.Top + shp.Height + "50"
    'ActiveSheet.Protect Password:=""
End Sub
 
Even if I do that, the image is still split between both pages if nearing the bottom.
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
In that case, I'm afraid I can't help you....and I note that there has been no input from anyone else, so I'm guessing it's a little tougher than you think !!!
 
Upvote 0
Could anyone else help me please?

To summarise, I have a spreadsheet with a button that inserts a custom signature image several lines below a notes box. The notes box is below a table that can have lines added to it for additional information to be entered. If enough lines have been added to the table or enough text written in the notes box to place the bottom of the notes box close to the bottom of the page, the custom signature image is placed half on one page and half on the next. If this happens, I need the code to push it to the second page so it is not split between pages.
 
Upvote 0
A couple of things to consider
1. Make the macro "fit to page" so everything is reduced slightly to fit one page
2. As mentioned before, force a page break at the end of the data in Col "H", which will force the notes box AND the sgnature onto the second page
 
Upvote 0
But if I make it fit to one page, it might be very small as the quote could be up to 8 pages long. If this is squeezed into one page, the text will be very small.
 
Upvote 0
You did ask for ideas !
There is still option 2.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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
Back
Top