View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Paul Robinson Paul Robinson is offline
external usenet poster
 
Posts: 208
Default " Select method of range class failed" if sheet not on top

Hi
Never activate if you don't have to

Worksheets("Effic").Range("B3:F18").Pictures.Inser t (Filename$)

will probably work if the code worked originally with the sheet on
top.
Not checked though.
regards
Paul

On May 14, 6:50*am, jad700 wrote:
Dim Pict As Object
Dim p As Object
Filename$ = "C:\aScopePic\jdpic7.png"
DoThis$ = "c:\windows\wgetbin\wget.exe *-t1 -O"
DoThis$ = DoThis$ + "C:\aScopePic\jdpic8.png"
DoThis$ = DoThis$ + " 10.32.54.19/Image.png"
If Dir(Filename$) = "" Then Stop
ret = Shell(DoThis$):
' Works so far, pic saved locally
' Now the following works ONLY if the Effic tab was on top when I run
the VBA
' Otherwise the next line *returns " Select method of range class
failed"
Worksheets("Effic").Range("B3:F18").Select
Worksheets("Effic").Range("B3:F18").Activate
ActiveSheet.Pictures.Insert (Filename$)
' I would like to be able to insert the picture onto any of the
sheets
' THANK YOU !!!!