Correcting URL in VBA code

DanishViking

New Member
Joined
Feb 11, 2020
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi,

This is actually a VBA code for use in Power Point. The purpose is that employees enter some initials and then the profile picture is fetched from the Corporate Microsoft SharePoint site and inserted into a square with rounded corners.

However, I am having difficulty getting the URL address to function properly with inserting the Initials (XXXX). The format should be: https://companyname.sharepoint.com/sites/HQ/_layouts/15/UserPhoto.aspx?size=m&accountName=Initials@companyname.com"

Thanks for your help and inputs!

See code snippet below:
[CODE=vba]Public Sub InsertSharepointPic() 'Get user initials: Dim usr As String usr = UCase(CreateObject("wscript.network").UserName) 'Ask user for initials initials = InputBox(Prompt:="Initials of employee", Title:="Insert phonebook picture", Default:=usr) If initials = "" Then Exit Sub End If Dim r_margin As Double, l_margin As Double, t_margin As Double, b_margin As Double Call getSlideDim(r_margin, l_margin, t_margin, b_margin) ContinueProcess: 'make rounded rectangle to fill ActiveWindow.Selection.SlideRange.Shapes.AddShape(msoShapeRoundedRectangle, l_margin, t_margin, 140, 122).Select 'fill rounded rectangle with picture With ActiveWindow.Selection.ShapeRange .Line.Visible = msoFalse .Fill.Transparency = 0# .Fill.Visible = msoTrue .Fill.UserPicture [COLOR=rgb(184, 49, 47)]"https://companyname.sharepoint.com/sites/HQ/_layouts/15/UserPhoto.aspx?size=m&accountName=" & initials & "@companyname.com"[/COLOR] End Sub[/CODE]
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Forum statistics

Threads
1,214,975
Messages
6,122,538
Members
449,088
Latest member
RandomExceller01

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