Hi
I have a large workbook with a variety of documents the majority of whichhave my company logos as standard but I need to be able to insert the customerlogo into these sheets. The position and size of the logo is different from onesheet to another so pasting to a specific cell is not going to work. I’m hopingsomeone can tell me how to insert the customers logo into a text box on all therequired sheets using VBA, I have tried a number of ways including the codebelow (which is a test for one sheet only) which I have tried to place the logointo a textbox. But I have a number of issues.
1. I can’t get the image to resize to the textbox - makes it the textbox bigger and no longer fits the sheet layout
2. As there a large number of sheets I think I need a common name forthe text box on each sheet so that I can use a “For Each wsheet ….Next wsheet” routine to insert the logo into eachsheet that has the named text box (without changing the text box size). I have triedplacing a text box on a number of sheets with the same name but excel doesn’tseem to allow this?
This workbook is to be used by a number of users in different locationswho may have their folders ordered/named differently. So copy paste from a sheetin the workbook would be my preference. I have tried copy/paste from a sheet inthe workbook rather than from a file location but that wasn’t successful either.
Any suggestions? I would be very grateful for any assistance Thanks
Sub ShapePicture()
Dim TextboxName As String
Dim xSh As Shape
Dim xPic As IPictureDisp
Dim xFileName As String
TextboxName = "TextBox4"
xFileName = "F:\Logos& Graphics\CustomerLogo.JPG"
Set xPic =LoadPicture(xFileName)
Set xSh =Sheets("Section Divider (11)").Shapes(TextboxName)
xSh.Height = xPic.Height /xPic.Width * xSh.Width
Set xPic =LoadPicture("")
Set xPic = Nothing
xSh.Fill.UserPicturexFileName
End Sub
I have a large workbook with a variety of documents the majority of whichhave my company logos as standard but I need to be able to insert the customerlogo into these sheets. The position and size of the logo is different from onesheet to another so pasting to a specific cell is not going to work. I’m hopingsomeone can tell me how to insert the customers logo into a text box on all therequired sheets using VBA, I have tried a number of ways including the codebelow (which is a test for one sheet only) which I have tried to place the logointo a textbox. But I have a number of issues.
1. I can’t get the image to resize to the textbox - makes it the textbox bigger and no longer fits the sheet layout
2. As there a large number of sheets I think I need a common name forthe text box on each sheet so that I can use a “For Each wsheet ….Next wsheet” routine to insert the logo into eachsheet that has the named text box (without changing the text box size). I have triedplacing a text box on a number of sheets with the same name but excel doesn’tseem to allow this?
This workbook is to be used by a number of users in different locationswho may have their folders ordered/named differently. So copy paste from a sheetin the workbook would be my preference. I have tried copy/paste from a sheet inthe workbook rather than from a file location but that wasn’t successful either.
Any suggestions? I would be very grateful for any assistance Thanks
Sub ShapePicture()
Dim TextboxName As String
Dim xSh As Shape
Dim xPic As IPictureDisp
Dim xFileName As String
TextboxName = "TextBox4"
xFileName = "F:\Logos& Graphics\CustomerLogo.JPG"
Set xPic =LoadPicture(xFileName)
Set xSh =Sheets("Section Divider (11)").Shapes(TextboxName)
xSh.Height = xPic.Height /xPic.Width * xSh.Width
Set xPic =LoadPicture("")
Set xPic = Nothing
xSh.Fill.UserPicturexFileName
End Sub