How to load an image from Sharepoint into image control

jqfranco

New Member
Joined
Dec 27, 2017
Messages
28
Good afternoon
I made a form in Microsoft Forms, so that they send me cell phone pictures.
These images come to me with a Sharepoint link, for example:
"https://xxxxxxxcom.sharepoint.com/sites/es_sharepoint_communicationsite/Shared%..."

What happens is that the image that is downloaded is black. If I test it with any image from the internet, it works fine.
I think the fact is that the image is on Sharepoint and the link I receive cannot be accessed externally.

Can anyone help me resolve this issue? Thank you for your help


VBA Code:
Private Declare PtrSafe Function URLDownloadToFile Lib "urlmon" _
    Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, _
    ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

Sub CommandButton1_Click()
    Dim imgsrc As String
    Dim dlpath As String
    imgsrc = "https://static.kbb.com.br/Uploads/ResearchTools/News/3099/31b6ebf5-06f6-42d0-91d8-b5e6aae08a35_1365x1024.jpg"
    dlpath = "C:\Meu_Backup\"
    URLDownloadToFile 0, imgsrc, dlpath & "HK Skyline.jpg", 0, 0
    Form_01_Entrada.MultiPage1.Pages(2).Image4.Picture = LoadPicture("C:\Meu_Backup\HK Skyline.jpg")
End Sub
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,213,497
Messages
6,113,999
Members
448,543
Latest member
MartinLarkin

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