Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Inserting an Image in an Excel sheet using VBScript. | Excel Programming | |||
Inserting an image in an excel sheet using QTP ! | Excel Programming | |||
Inserting an image in an excel sheet using QTP ! | Excel Programming | |||
Debug RuntimeError 1004 in Chart | Excel Programming | |||
Inserting CGM images in Excel changes image aspect ratio | Excel Programming |