Image in Footer via VBA

toneloke

New Member
Joined
Mar 16, 2012
Messages
45
Hey guys,

I hope you can assist me... I am trying to protect a document by having a particular footer appear every time a person saves. I have to make multiple versions of the document for different people and am battling to the get the image to change per saved version.

I, by the stroke of luck, got the 1st one to work, but now when I need to change the image in a new version, the original image remains. The text changes but the image does not.

The image is found in the same sheet - if there is a better way to do this, I would also welcome guidance.

I might be a little short on some code to help make this happen. Your kind assistance would be so appreciated.

Here is my code:

Sub Macro1()
With ActiveSheet.PageSetup.RightFooterPicture
.FileName = "Picture 5"
End With
ActiveSheet.PageSetup.RightFooter = "&G"
End Sub

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
With ws.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = "For exclusive use, as the facilitator, by Gatehouse"
.RightFooter = "&G"
End With
Next ws
End Sub

Thank you
 
Hey John,

Sorry... another glitch in the matrix. I see in the code that we have DrawObjects = True, but the people trying to use the document are unable to load an image into the sheet. There is one cell where I need a photo added ( it is an unlocked cell ) and the current VBA won't let this happen. I tried selecting Edit objects, which is not ideal as this opens a logo up to tampering which I would prefer not to happen. Why is the sheet not allowing to insert a picture in an unlocked cell if we have DrawObjects = True in the code?

I hope this is the last thing and thank you so much for all your help so far.
 
Upvote 0

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
The additional code was just what the macro recorder generated. Try it with DrawingObjects:=False.
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

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