How do I change this code, so that the macro runs when the workbook opens?
Code:
Sub InsertMap_Click()
'Updateby Extendoffice 20161116
Dim Pshp As Shape
Dim xRg As Range
Dim xCol As Long
On Error Resume Next
Application.ScreenUpdating = False
Set Rng = ThisWorkbook.Sheets("Executive Summary").Range("A39")
filenam = Rng
Range("C40").Select
ThisWorkbook.Sheets("Executive Summary").Pictures.Insert(filenam).Select
Set Pshp = Selection.ShapeRange.Item(1)
If Pshp Is Nothing Then GoTo lab
With Pshp
.Name = "Membership Map"
.LockAspectRatio = msoFalse
.width = 600
.height = 600
' .Top = xRg.Top + (xRg.height - .height) / 2
' .Left = xRg.Left + (xRg.width - .width) / 2
End With
lab:
Set Pshp = Nothing
Range("C40").Select
Application.ScreenUpdating = True
End Sub
Last edited by a moderator: