VBA Loadpicture method failing ?

mikeprice53

Active Member
Joined
Jan 21, 2003
Messages
297
anyone have any answers for the following?

Img_Piccy.Picture = LoadPicture("http://www.grattan.co.uk/SS04/images/main/large/38C672.jpg")

The error I am getting here is error 75 which is an error that states "Path/File Access Error" and after doing a little bit of research could be due to the fact that the images I am trying to load being write protected !!!

Somehow though I dont think that is the case and beleive it may be down more to the fact that it is having trouble just connecting to the net...

Anyone ever tried this method before or is it just me doing something blatently wrong ? Please help as this is a huge part of the project I am currently working on and is givin' me a head ache :(

thanks in advance and sure hope that someone can shed a little bit of light on the subject...

Mike
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Is there no other way, there has to be something?

I was kinda hoping that all teh images I was after would be located somewhere on our company network, but ...NOPE !

Thanks for the heads up on that though Andrew at least I know that much now and wont think its my code :cry:
 
Upvote 0
Strange thing ( Just remembered ) that if I went to the properties window in VBA and the picture path box and entered the absolute reference it works... Strange that it dosn't if you use code ?
 
Upvote 0
Well Help says:

While designing a form, you can use the control's property page to assign a bitmap to the Picture property. While running a form, you must use the LoadPicture function to assign a bitmap to Picture.

And it seems the LoadPicture function doesn't support URLs.

Sorry, I don't know a solution.
 
Upvote 0
Mike,

Is this the right picture? Is this your girl friend?

Code:
Sub test()
Dim YourPic As Picture
Dim mPath As String
Dim myPic As Variant

mPath = "http://www.grattan.co.uk/SS04/images/main/large/"
myPic = "38C672.jpg"

With ActiveSheet.Range("C1")
    Set YourPic = .Parent.Pictures.Insert(mPath & myPic)
    YourPic.Top = .Top
   ' YourPic.Width = .Width
   ' YourPic.Height = .Height
    YourPic.Left = .Left
End With
End Sub
Regards,

Mike
 
Upvote 0
nah but if she is available I dont think I would say no ;0)

just a website that is similar to the one I will be using...

I will give that Method a go now thanks gentlemen for the help :0)

Mike
 
Upvote 0
Tried your code - works great on sheet but dosnt seem to want to do it on a userform picture box, presumabley this is something to do with what andrew is saying.

what I used from your code and changed it to :

Private Sub CommandButton1_Click()

Dim YourPic As Picture
Dim mPath As String
Dim myPic As Variant

mPath = "http://www.grattan.co.uk/SS04/images/main/large/"
myPic = "38C672.jpg"

With Img_Piccy.Picture
Set YourPic = .Parent.Pictures.Insert(mPath & myPic)
YourPic.Top = .Top
' YourPic.Width = .Width
' YourPic.Height = .Height
YourPic.Left = .Left
End With
End Sub

Again Thank you.
 
Upvote 0
:rolleyes: :pray: :rolleyes: :pray: :rolleyes: :pray: :rolleyes: :pray: :rolleyes: :pray: :rolleyes: :pray: :rolleyes:

I have had a further thougth on this but not easy for me to check this out at work as I do not get access to the C:\ folder as we are on a huge network with alot of restrictions...

If I was to use the above method to paste this onto a sheet would it then be stored in the clipbaord ?

If it is- is it then not stored ina temporary internet files folder ( standardised one ) that could then be linked to the original way as to be able to use teh load picture method ?

Seems like a long winded way around but heh its one heck of a challenge ;0) Any help on Clipboard memory info hugely appreciated...

Thanks

:oops:
 
Upvote 0

Forum statistics

Threads
1,216,449
Messages
6,130,711
Members
449,588
Latest member
ahmed Adel

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