stephenscott
New Member
- Joined
- Mar 19, 2008
- Messages
- 29
I have built a Excel Form which includes merged cells and am trying to build a macro to call for the signature and insert it is a specific cell within a password protected template.
The specific cell is Merged and it N58, however the macro below positions it up near cell 3?
Cel N58 is a constant for all signatures which I an trying to get it to resize to fir the cell area.
Also as a "bonus" I am looking for a simple way to unsert the individual users email address and wondered if I could call from their user properties within windows or excel?
Any suggestions would be greatly appreciated.
Stephenscott
-----------------------------------------------------------------------------------------
Sub InsertSignature()
Dim PicLocation As String
Dim MyRange As String
ActiveSheet.Unprotect
Range("N58").Select
MyRange = Selection.Address
PicLocation = Application.GetSaveAsFilename("Q:\Signatures\", "Image Files (*.jpg),*.jpg", , "Specify Image Location")
If PicLocation <> "False" Then
ActiveSheet.Pictures.Insert(PicLocation).Select
Else
Exit Sub
End If
With Selection.ShapeRange
.LockAspectRatio = msoTrue
If .Width > .Height Then
.Width = Range(MyRange).Width
If .Height > Range(MyRange).Height Then .Height = Range(MyRange).Height
Else
.Height = Range(MyRange).Height
If .Width > Range(MyRange).Width Then .Width = Range(MyRange).Width
End If
End With
With Selection
.Placement = xlMoveAndSize
.PrintObject = True
End With
ActiveSheet.Protect
End Sub
The specific cell is Merged and it N58, however the macro below positions it up near cell 3?
Cel N58 is a constant for all signatures which I an trying to get it to resize to fir the cell area.
Also as a "bonus" I am looking for a simple way to unsert the individual users email address and wondered if I could call from their user properties within windows or excel?
Any suggestions would be greatly appreciated.
Stephenscott
-----------------------------------------------------------------------------------------
Sub InsertSignature()
Dim PicLocation As String
Dim MyRange As String
ActiveSheet.Unprotect
Range("N58").Select
MyRange = Selection.Address
PicLocation = Application.GetSaveAsFilename("Q:\Signatures\", "Image Files (*.jpg),*.jpg", , "Specify Image Location")
If PicLocation <> "False" Then
ActiveSheet.Pictures.Insert(PicLocation).Select
Else
Exit Sub
End If
With Selection.ShapeRange
.LockAspectRatio = msoTrue
If .Width > .Height Then
.Width = Range(MyRange).Width
If .Height > Range(MyRange).Height Then .Height = Range(MyRange).Height
Else
.Height = Range(MyRange).Height
If .Width > Range(MyRange).Width Then .Width = Range(MyRange).Width
End If
End With
With Selection
.Placement = xlMoveAndSize
.PrintObject = True
End With
ActiveSheet.Protect
End Sub