![]() |
Inserting an image into Excel from FTP - occasional 1004 runtimeerror
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. |
Inserting an image into Excel from FTP - occasional 1004 runtime e
On Error GoTo PROC_ERR
PROC_ERR: MsgBox "Error " & Err.Number & ", " & Err.Description & ", ", vbCritical, Err.Source GoTo where ever Resume "james" wrote: 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. |
All times are GMT +1. The time now is 07:31 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com