I'm using the following code to grab an image (of a part held on a SharePoint site) to display in an excel sheet. I'd like to use the user's own Active Directory credentials to access the url. The code I've got so far is:
Dim Request As Object
Dim ResponseStatus As Variant
Dim ImgURL As String
ImgURL = "https://someValidURL/" & ExtraPartNo & ".jpg"
Set Request = CreateObject("WinHttp.WinHttpRequest.5.1")
With Request
.Open "GET", ImgURL, True
.Send
.WaitForResponse
ResponseStatus = .StatusText
End With
Set Request = Nothing
If ResponseStatus = "OK" Then
ImgURL = "https://someValidURL/" & ExrtaPartNo & ".jpg"
Else
SetterImgURL = "https://someValidURL/AwaitingImage.jpg"
End If
The idea is to display an image of a part if it exists but if it doesn't then display the AwaitingImage.jpg