Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting an Image in an Excel sheet using VBScript. Vishal[_3_] Excel Programming 3 July 28th 05 03:32 PM
Inserting an image in an excel sheet using QTP ! Vishal[_3_] Excel Programming 1 July 28th 05 06:37 AM
Inserting an image in an excel sheet using QTP ! Vishal[_3_] Excel Programming 0 July 27th 05 08:32 PM
Debug RuntimeError 1004 in Chart MichaelC Excel Programming 15 June 17th 05 06:49 PM
Inserting CGM images in Excel changes image aspect ratio Dinesh[_3_] Excel Programming 0 July 28th 04 09:47 PM


All times are GMT +1. The time now is 09:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"