JPEG code tweak

rickblunt

Well-known Member
Joined
Feb 18, 2008
Messages
609
Office Version
  1. 2019
Platform
  1. Windows
Greetings, I have been the using the following code (thanks VoG!) to insert users names into text boxes on worksheets and it works great. So much so that I need to roll it out into some other documents. The rub was that when the original WB was set up it was only being used on my own or my bosses computer so I just put the signatures (the jpg's) in a folder on my computer. Now that the WB is getting passed around....

I put each of the jpg's in a blank WS in my book and tried to tweak the code to just pick it off of the WS instead of the desktop and had no luck (too embarassed to show you my attempts); can anyone give me a hand with this or is this something that cannot really be done properly. Basically I want to just put the signature jpg's on a worksheet in the in the same WB; I will probably even hide the sheet once I protect the WB and send it out. Thanks for any input - Rick

Code:
Sub RickSignature()
'
' This macro uses a JPEG of a signature as the fill of an textbox.
'
'
Dim s As String
On Error Resume Next
s = Selection.Name
On Error GoTo 0
If s = "" Or Not s Like "Rectangle*" Then
    MsgBox "Click on a rectangle first"
    Exit Sub
End If
    Selection.ShapeRange.Fill.Transparency = 0#
    Selection.ShapeRange.Line.Weight = 2#
    Selection.ShapeRange.Line.DashStyle = msoLineSolid
    Selection.ShapeRange.Line.Style = msoLineSingle
    Selection.ShapeRange.Line.Transparency = 0#
    Selection.ShapeRange.Line.Visible = msoTrue
    Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 0)
    Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
    Selection.ShapeRange.Fill.Visible = msoTrue
    Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 255, 255)
    Selection.ShapeRange.Fill.BackColor.RGB = RGB(255, 255, 255)
    Selection.ShapeRange.Fill.UserPicture _
        "C:\Documents and Settings\rblunt1\Desktop\Rick.jpg"
End Sub
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,224,564
Messages
6,179,547
Members
452,925
Latest member
duyvmex

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