How to load images on Sharepoint to as image control

%3CLINGO-SUB%20id%3D%22lingo-sub-2865844%22%20slang%3D%22en-US%22%3EHow%20to%20load%20images%20on%20Sharepoint%20to%20as%20image%20control%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2865844%22%20slang%3D%22en-US%22%3E%3CP%3EGood%20afternoon%3CBR%20%2F%3EI%20made%20a%20form%20in%20Microsoft%20Forms%2C%20so%20that%20they%20send%20me%20cell%20phone%20pictures.%3CBR%20%2F%3EThese%20images%20come%20to%20me%20with%20a%20Sharepoint%20link%2C%20for%20example%3A%3CBR%20%2F%3E%22%3CA%20href%3D%22https%3A%2F%2Fxxxxxxxcom.sharepoint.com%2Fsites%2Fes_sharepoint_communicationsite%2FShared%25%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fxxxxxxxcom.sharepoint.com%2Fsites%2Fes_sharepoint_communicationsite%2FShared%25%3C%2FA%3E...%22%3C%2FP%3E%3CP%3EWhat%20happens%20is%20that%20the%20image%20that%20is%20downloaded%20is%20black.%20If%20I%20test%20it%20with%20any%20image%20from%20the%20internet%2C%20it%20works%20fine.%3CBR%20%2F%3EI%20think%20the%20fact%20is%20that%20the%20image%20is%20on%20Sharepoint%20and%20the%20link%20I%20receive%20cannot%20be%20accessed%20externally.%3C%2FP%3E%3CP%3ECan%20anyone%20help%20me%20resolve%20this%20issue%3F%20Thank%20you%20for%20your%20help%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-visual-basic%22%3E%3CCODE%3EPrivate%20Declare%20PtrSafe%20Function%20URLDownloadToFile%20Lib%20%22urlmon%22%20_%0A%20%20%20%20Alias%20%22URLDownloadToFileA%22%20(ByVal%20pCaller%20As%20Long%2C%20ByVal%20szURL%20As%20String%2C%20_%0A%20%20%20%20ByVal%20szFileName%20As%20String%2C%20ByVal%20dwReserved%20As%20Long%2C%20ByVal%20lpfnCB%20As%20Long)%20As%20Long%0A%0ASub%20CommandButton1_Click()%0A%20%20%20%20Dim%20imgsrc%20As%20String%0A%20%20%20%20Dim%20dlpath%20As%20String%0A%20%20%20%20imgsrc%3D%22https%3A%2F%2Fstatic.kbb.com.br%2FUploads%2FResearchTools%2FNews%2F3099%2F31b6ebf5-06f6-42d0-91d8-b5e6aae08a35_1365x1024.jpg%22%0A%20%20%20%20dlpath%20%3D%20%22C%3A%5CMeu_Backup%5C%22%0A%20%20%20%20URLDownloadToFile%200%2C%20imgsrc%2C%20dlpath%20%26amp%3B%20%22HK%20Skyline.jpg%22%2C%200%2C%200%0A%20%20%20%20Form_01_Entrada.MultiPage1.Pages(2).Image4.Picture%20%3D%20LoadPicture(%22C%3A%5CMeu_Backup%5CHK%20Skyline.jpg%22)%0AEnd%20Sub%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2865844%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Contributor

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

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
0 Replies