MarkCBB
Active Member
- Joined
- Apr 12, 2010
- Messages
- 497
Hi there,
I am using some code I found on the internet, but I have made some samll changes to it and I am getting a Run-time error 481 - Invalid picture
Some of the Pitures do load but some of them dont load.
Here is the code I am using
I am using some code I found on the internet, but I have made some samll changes to it and I am getting a Run-time error 481 - Invalid picture
Some of the Pitures do load but some of them dont load.
Here is the code I am using
Code:
Public Declare 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
Public Sub GURoL(url As String, FileName As String)
Dim lngRetVal As Long
lngRetVal = URLDownloadToFile(0, url, FileName, 0, 0)
If lngRetVal <> 0 Then
MsgBox "GURol godo: Can't download from " & url & " to " & FileName
End If
End Sub
Sub Download_Procedure()
Dim MyPictureLink As String
Dim MyPictureName As String
Dim MyImage As Variant
'Please note I have removed the atual URl and replaced the text with MyUrlGoesHere
MyPictureLink = "MyUrlGoesHere" & Sheet8.Range("o156").Value
MyPictureName = Sheet8.Range("F2").Value
Call GURoL(MyPictureLink, "C:\testing\" & MyPictureName & ".Png")
Sheet7.Image1.Picture = LoadPicture("C:\testing\" & MyPictureName & ".Png")
End Sub