Inserting an image into Excel from FTP - occasional 1004 runtimeerror

J

james

greetings,

I have the following code and occasionally I get a 1004 runtime error
on the 'ActiveSheet.Pi...' line. I assume it is because for some
reason Excel has trouble downloading the image from the ftp site.

My real question is, can I do some kind of error checking so that if
there is this runtime error, the I can have a msgbox appear of my own
making - not the "End/Debug" message that i get with the 1004 error
(ie. i want the code to recognise the error but keep going!).


link_1 = "ftp://ftp2.bom.gov.au/anon/gen/nwp/IDYPME05/2008060512/
PMEPROB_nsw.png"

Sheets("Calc").Range("A3").Select 'select cell we want the image
to go into
ActiveSheet.Pictures.Insert(link_1).Select 'inserts image from FTP
Selection.ShapeRange.LockAspectRatio = msoTrue 'ensure aspect
ration remains the same
Selection.ShapeRange.Width = 350# 'change width to 300

Cheers,
James.
 
D

dmoney

On Error GoTo PROC_ERR

PROC_ERR:
MsgBox "Error " & Err.Number & ", " & Err.Description & ", ",
vbCritical, Err.Source
GoTo where ever
Resume
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top