Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > alt.computer > #10535
| From | Robert Baer <robertbaer@localnet.com> |
|---|---|
| Newsgroups | alt.computer, sci.electronics.design |
| Subject | Re: OT: How find Excel Picture number |
| References | <DAxMB.4$zb.2@fx44.iad> <otue9v$1701$1@gioia.aioe.org> <W7QMB.7971$sC6.1410@fx35.iad> <ou13tm$2ds$1@gioia.aioe.org> |
| Message-ID | <NE0NB.1633$Da3.816@fx39.iad> (permalink) |
| Date | 2017-11-09 09:55 -0800 |
Cross-posted to 2 groups.
Martin Brown wrote: > On 09/11/2017 03:41, Robert Baer wrote: >> Martin Brown wrote: >>> On 08/11/2017 06:35, Robert Baer wrote: >>>> In Excel, I was able to find the names/picture numbers for the >>>> first two shapes by trial and error. >>>> Then i added a third shape and unable to find the number; up to >>>> Number 35 and am tired of this BS. >>>> Is there a way of finding it so i can use it? >>>> As in ActiveSheet.Shapes(<name>).Select ? >>>> >>>> Thanks. >>> >>> Your problem here is that a lot of other things are shapes - search >>> through the range of shapes checking for those with .Type=msoPicture > >> * Range of shapes? when one cannot be eXplicitly be found? >> Not an option. > > You seem not to understand any of the internal Excel structures that you > are trying to manipulate. I have a bit of sympathy it can look a little > bit like the maze in Zork if you don't understand the architecture. > >>> Their name will begin with "Picture " too but that is slower. >>> >>> Either insert all the pictures first or last if you want them to be in >>> consecutive numerical order. >> * Oh, but i did; made some changes, and deleted some to create/insert >> others. Am thinking this latest addition is way out there, like >> Picture 75 as a guess. >>> >> There is absolutely no way to access these directly, much less in >> order. >> After a lot of messing around, this was only reliable result: >> >> pic = 1 ' or object but NOT picture >> ' 1=vert; 2=horiz; 3=frame; 4=small; 5=title >> For Each iobj In ActiveSheet.Shapes 'DrawingObjects >> iobj.Select >> If pic = 2 Then >> Selection.Copy 'get horizontal jumper >> End If >> pic = pic + 1 >> Next iobj >> >> For removal of stuff/objects added by program: >> >> Klear: >> 'Erase jumpers for next try >> ' 1=vert; 2=horiz; 3=frame; 4=small; 5=title >> num = 1 >> For Each iobj In ActiveSheet.Shapes 'DrawingObjects >> iobj.Select >> If num > 4 Then >> iobj.Delete >> End If >> num = num + 1 >> Next iobj >> Close >> >> Note my objects 1-4 are reference for copy/paste operations. > > It is hard to tell what your convoluted clueless clutter is trying to do > but the following short script will show you all the objects names and > might if you have even two brain cells give you an idea how to proceed. * The code i presented is "clutter" despite the fact that it works? > > Sub test() > i = 0 > For Each s In ActiveSheet.Shapes > i = i + 1 > Debug.Print i, s.Name, s.Type, s.Type = msoPicture > Next s > End Sub * Nothing happens. Nice try. > > > Your code would look a lot less clumsy if you used Shapes.Count and a > for loop. Hint you can also access Shapes(n) where n is an integer. * "Clumsy"? Cannot be more simple. Shapes(n) did not work: compile error; Sub or Function not defined. Also, Shapes.Count does not work: object required. > > I have only mirrored your coding style here to help you understand. > > iobj.Select is redundant and pointless inside the loop * There is NO OTHER WAY to get the object. Only pointless if one does not want it in the first place. > > There are books about on coding in VBA I suggest you invest in one! * Have two; almost as useless as the Excel so-called "help". >
Back to alt.computer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
OT: How find Excel Picture number Robert Baer <robertbaer@localnet.com> - 2017-11-07 22:35 -0800
Re: OT: How find Excel Picture number Paul <nospam@needed.invalid> - 2017-11-08 01:45 -0500
Re: OT: How find Excel Picture number Robert Baer <robertbaer@localnet.com> - 2017-11-08 00:13 -0800
Re: OT: How find Excel Picture number Paul <nospam@needed.invalid> - 2017-11-08 03:21 -0500
Re: OT: How find Excel Picture number Robert Baer <robertbaer@localnet.com> - 2017-11-08 19:51 -0800
Re: OT: How find Excel Picture number Jeroen Belleman <jeroen@nospam.please> - 2017-11-08 09:12 +0100
Re: OT: How find Excel Picture number Robert Baer <robertbaer@localnet.com> - 2017-11-08 19:23 -0800
Re: OT: How find Excel Picture number Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2017-11-08 08:12 +0000
Re: OT: How find Excel Picture number Robert Baer <robertbaer@localnet.com> - 2017-11-08 19:41 -0800
Re: OT: How find Excel Picture number Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2017-11-09 08:33 +0000
Re: OT: How find Excel Picture number Robert Baer <robertbaer@localnet.com> - 2017-11-09 09:55 -0800
Re: OT: How find Excel Picture number Paul <nospam@needed.invalid> - 2017-11-09 14:12 -0500
Re: OT: How find Excel Picture number Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2017-11-09 20:20 +0000
Re: OT: How find Excel Picture number Robert Baer <robertbaer@localnet.com> - 2017-11-10 17:15 -0800
Re: OT: How find Excel Picture number Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2017-11-13 16:32 +0000
csiph-web