PC Review


Reply
Thread Tools Rate Thread

Check for a shape - then change or delete it if it exists

 
 
=?Utf-8?B?TW9uYS1BQkU=?=
Guest
Posts: n/a
 
      30th May 2007
I have a spreadsheet which contains lines that have been drawn using vba.
During the drawing the process they are named like this myLine.Name = "Arrow"
& CStr(PasteRow). The variables "myline" (shape object) and "pasterow" (long
number)have been declared and defined. When content on the spreadsheet
changes the arrows' positions and lengths can be affected, or they may be
deleted if no longer needed. I need to search to see if an arrow exists,
change it and or delete it. What do you suggest (using Excel 2003 SP2)?

--
Thanks!
Mona-ABE
 
Reply With Quote
 
 
 
 
WhytheQ
Guest
Posts: n/a
 
      30th May 2007
Dim myShape
if ActiveSheet.shapes.count>0 then
for each myShape in ActiveSheet.shapes
if myShape.name = "Arrow" then

'stick code in here for the actions you want to take once
this shape has been found

end if
next
end if


Not sure if the above helps - but maybe its a start
J




On 30 May, 14:25, Mona-ABE <Mona...@discussions.microsoft.com> wrote:
> I have a spreadsheet which contains lines that have been drawn using vba.
> During the drawing the process they are named like this myLine.Name = "Arrow"
> & CStr(PasteRow). The variables "myline" (shape object) and "pasterow" (long
> number)have been declared and defined. When content on the spreadsheet
> changes the arrows' positions and lengths can be affected, or they may be
> deleted if no longer needed. I need to search to see if an arrow exists,
> change it and or delete it. What do you suggest (using Excel 2003 SP2)?
>
> --
> Thanks!
> Mona-ABE



 
Reply With Quote
 
Tim
Guest
Posts: n/a
 
      30th May 2007
dim s

on error resume next
set s=activesheet.shapes(shapename)
on error goto 0

if not s is nothing then
.... do something with s
end if

Tim


"Mona-ABE" <(E-Mail Removed)> wrote in message
news:AF9AE556-40A0-4C32-BAE9-(E-Mail Removed)...
>I have a spreadsheet which contains lines that have been drawn using vba.
> During the drawing the process they are named like this myLine.Name =
> "Arrow"
> & CStr(PasteRow). The variables "myline" (shape object) and "pasterow"
> (long
> number)have been declared and defined. When content on the spreadsheet
> changes the arrows' positions and lengths can be affected, or they may be
> deleted if no longer needed. I need to search to see if an arrow exists,
> change it and or delete it. What do you suggest (using Excel 2003 SP2)?
>
> --
> Thanks!
> Mona-ABE



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check if a query exists and if it finds to delete Jack Microsoft Access VBA Modules 3 17th Sep 2009 07:34 PM
Check if shape exist Hans Hubers Microsoft Excel Programming 3 26th May 2008 02:45 PM
verify a shape exists in the sheet vandaley Microsoft Excel Programming 3 29th Oct 2006 12:22 PM
Check to see if files exists and delete it. Steven M. Britton Microsoft Access VBA Modules 7 17th Jun 2004 07:22 AM
Can you check if an object exists, and only it it does, delete it =?Utf-8?B?Q3JhaWc=?= Microsoft Access Macros 2 19th Dec 2003 01:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:43 AM.