xlf | xlfAddLogoToBanner
Add a logo image to the worksheet
Add the xlf logo image to a worksheet (figure 1), similar to the logo on this web page.
xlfAddLogoToBanner - the VBA code
In this example, the picture image file is located on a web server. Code 1 uses the mso AddPicture method. The image location and size is measured in points, where 1 point is equal to 1/72 of an inch.
Code 1: Sub procedure
xlfAddLogoToBanneradd xlf logo to a selected area of worksheet
Private Sub xlfAddLogoToBanner() Dim imgSource As String imgSource = "http://excelatfinance.com/online/wp-content/uploads/2015/06/xlf.png" ActiveSheet.Shapes.AddPicture imgSource, msoFalse, msoTrue, 13, 13, 35, 35 End Sub
|AddPicture method - Creates a picture from an existing file (local or remote / web). Returns a Shape object that represents the new picture.|
|argument / parameter||details|
|Filename||required||string - the source of the picture file|
|LinkToFile||required||MsoTriState [msoTrue / msoFalse] - make an independent copy of the file|
|SaveWithDocument||required||MsoTriState [msoTrue / msoFalse] - save the picture with the workbook|
|Left||required||single - distance from left of worksheet to the left of the picture in points|
|Top||required||single - distance from top of worksheet to the top of the picture in points|
|Width||required||single - the width of the picture in points|
|Height||required||single - the height of the picture in points|
Run the private procedure from the VBE. Use F5 or Run > Run Sub on the menu.
- This example was developed in Excel 2013 Pro 64 bit.
- Revised: Sunday 9th of October 2016 - 04:49 PM, [Australian Eastern Standard Time (EST)]