Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > alt.computer > #10524 > unrolled thread
| Started by | Robert Baer <robertbaer@localnet.com> |
|---|---|
| First post | 2017-11-07 22:35 -0800 |
| Last post | 2017-11-13 16:32 +0000 |
| Articles | 15 — 4 participants |
Back to article view | Back to alt.computer
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
| From | Robert Baer <robertbaer@localnet.com> |
|---|---|
| Date | 2017-11-07 22:35 -0800 |
| Subject | OT: How find Excel Picture number |
| Message-ID | <DAxMB.4$zb.2@fx44.iad> |
[Multipart message — attachments visible in raw view] — view raw
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.
[toc] | [next] | [standalone]
| From | Paul <nospam@needed.invalid> |
|---|---|
| Date | 2017-11-08 01:45 -0500 |
| Message-ID | <otu96r$koq$1@dont-email.me> |
| In reply to | #10524 |
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.
Would something from this help ?
https://msdn.microsoft.com/en-us/vba/excel-vba/articles/shapes-range-property-excel
There's a .range operator. Would that cover
the top-most array index ?
Paul
[toc] | [prev] | [next] | [standalone]
| From | Robert Baer <robertbaer@localnet.com> |
|---|---|
| Date | 2017-11-08 00:13 -0800 |
| Message-ID | <P0zMB.1$Vy2.0@fx07.iad> |
| In reply to | #10525 |
Paul wrote:
> 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.
>
> Would something from this help ?
>
> https://msdn.microsoft.com/en-us/vba/excel-vba/articles/shapes-range-property-excel
* Don't know.
I do not remember how i created the first 2 "shapes"; the third one
is a copy/paste and manual resize.
>
>
> There's a .range operator. Would that cover
> the top-most array index ?
Array? What array? Does Excel automatically create an array and put
these in it?
Ditto for "range.
I think i found that ActiveSheet.Shapes(1).Select exists, and no other.
I know that ActiveSheet.Shapes("Picture 6").Select works, and that
ActiveSheet.Shapes("Picture 11").Select also works.
What s irking is that anything else creates an error and the Excel
OnError does NOT detect that error.
If it did,a loop counting from 1 to (say) 999 MIGHT find that third item.
That first "example" looks like one is creating an array arShapes,
but where in the hell did those names come from, what does each element
look like (do not trust names), and where did they come from?
I suppose i could have 3 GIF files, and Insert From File to
successive cells; note no "range" command used, no array foo, and
certainly no names.
This business is less clear than oily mud.
**
My relevant notes in the macro is:
'With myDocument.Shapes.BuildFreeform(msoEditingCorner, 260, 150)
' .AddNodes msoSegmentLine, msoEditingAuto, 400, 150
' .AddNodes msoSegmentLine, msoEditingAuto, 400, 180
' .AddNodes msoSegmentLine, msoEditingAuto, 260, 180
' .AddNodes msoSegmentLine, msoEditingAuto, 260, 150
' .ConvertToShape
'End With
' Have rectangle where i want the text
' Select that new shape...
' 'iobj.1 'for output display
' 'iobj.2 'vertical jumper
' 'iobj.3 'horizontal jumper
' 'iobj.4 'smaller jumper <---i ASSUME this is added shape
' so.. iobj.5 is new box
' ActiveSheet.Shapes(5).Select 'yes, have box
'*Do NOT need BuildFreeform
Labell = Range("J1").Text + "V"
Set sh = ActiveSheet.Shapes.AddShape _
(msoShapeRectangle, 260, 180, 150, 60)
sh.Fill.ForeColor.RGB = RGB(255, 255, 255)
sh.Fill.Visible = msoTrue 'False has same effect
sh.TextFrame.Characters.Text = Labell
sh.TextFrame.Characters.Font.Size = 36
sh.TextFrame.Characters.Font.Name = "Arial Black"
sh.TextFrame.Characters.Font.Bold = True
sh.TextFrame.Characters.Font.Color = vbRed
'With myDocument.Shapes.AddLine(260, 140, 120, 60).Line
' .DashStyle = msoLineDashDotDot
' .ForeColor.RGB = RGB(50, 0, 128)
'End With
sh.Line.DashStyle = msoLineDashDotDot
sh.Line.ForeColor.RGB = RGB(50, 0, 128)
'''
So,the third shape was made differently.
Above code partly stolen and partly via brute force from other stolen
code.
Certainly NOT from "examples" which essentially do not exist.
Thanks.
>
> Paul
[toc] | [prev] | [next] | [standalone]
| From | Paul <nospam@needed.invalid> |
|---|---|
| Date | 2017-11-08 03:21 -0500 |
| Message-ID | <otueq3$17st$1@gioia.aioe.org> |
| In reply to | #10528 |
Robert Baer wrote:
> Paul wrote:
>> 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.
>>
>> Would something from this help ?
>>
>> https://msdn.microsoft.com/en-us/vba/excel-vba/articles/shapes-range-property-excel
>>
> * Don't know.
> I do not remember how i created the first 2 "shapes"; the third one is
> a copy/paste and manual resize.
>
>>
>>
>> There's a .range operator. Would that cover
>> the top-most array index ?
> Array? What array? Does Excel automatically create an array and put
> these in it?
> Ditto for "range.
>
> I think i found that ActiveSheet.Shapes(1).Select exists, and no other.
> I know that ActiveSheet.Shapes("Picture 6").Select works, and that
> ActiveSheet.Shapes("Picture 11").Select also works.
> What s irking is that anything else creates an error and the Excel
> OnError does NOT detect that error.
> If it did,a loop counting from 1 to (say) 999 MIGHT find that third item.
>
> That first "example" looks like one is creating an array arShapes, but
> where in the hell did those names come from, what does each element look
> like (do not trust names), and where did they come from?
>
> I suppose i could have 3 GIF files, and Insert From File to successive
> cells; note no "range" command used, no array foo, and certainly no names.
>
> This business is less clear than oily mud.
> **
> My relevant notes in the macro is:
> 'With myDocument.Shapes.BuildFreeform(msoEditingCorner, 260, 150)
> ' .AddNodes msoSegmentLine, msoEditingAuto, 400, 150
> ' .AddNodes msoSegmentLine, msoEditingAuto, 400, 180
> ' .AddNodes msoSegmentLine, msoEditingAuto, 260, 180
> ' .AddNodes msoSegmentLine, msoEditingAuto, 260, 150
> ' .ConvertToShape
> 'End With
> ' Have rectangle where i want the text
> ' Select that new shape...
> ' 'iobj.1 'for output display
> ' 'iobj.2 'vertical jumper
> ' 'iobj.3 'horizontal jumper
> ' 'iobj.4 'smaller jumper <---i ASSUME this is added shape
> ' so.. iobj.5 is new box
> ' ActiveSheet.Shapes(5).Select 'yes, have box
>
> '*Do NOT need BuildFreeform
> Labell = Range("J1").Text + "V"
> Set sh = ActiveSheet.Shapes.AddShape _
> (msoShapeRectangle, 260, 180, 150, 60)
> sh.Fill.ForeColor.RGB = RGB(255, 255, 255)
> sh.Fill.Visible = msoTrue 'False has same effect
> sh.TextFrame.Characters.Text = Labell
> sh.TextFrame.Characters.Font.Size = 36
> sh.TextFrame.Characters.Font.Name = "Arial Black"
> sh.TextFrame.Characters.Font.Bold = True
> sh.TextFrame.Characters.Font.Color = vbRed
>
> 'With myDocument.Shapes.AddLine(260, 140, 120, 60).Line
> ' .DashStyle = msoLineDashDotDot
> ' .ForeColor.RGB = RGB(50, 0, 128)
> 'End With
>
> sh.Line.DashStyle = msoLineDashDotDot
> sh.Line.ForeColor.RGB = RGB(50, 0, 128)
> '''
> So,the third shape was made differently.
> Above code partly stolen and partly via brute force from other stolen
> code.
> Certainly NOT from "examples" which essentially do not exist.
>
> Thanks.
>
>
>>
>> Paul
>
Here's another idea.
https://stackoverflow.com/questions/32255992/how-do-i-list-all-existing-objects-in-an-excel-workbook-to-a-text-file
Paul
[toc] | [prev] | [next] | [standalone]
| From | Robert Baer <robertbaer@localnet.com> |
|---|---|
| Date | 2017-11-08 19:51 -0800 |
| Message-ID | <FhQMB.120$5H2.108@fx30.iad> |
| In reply to | #10529 |
Paul wrote:
> Robert Baer wrote:
>> Paul wrote:
>>> 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.
>>>
>>> Would something from this help ?
>>>
>>> https://msdn.microsoft.com/en-us/vba/excel-vba/articles/shapes-range-property-excel
>>>
>> * Don't know.
>> I do not remember how i created the first 2 "shapes"; the third one
>> is a copy/paste and manual resize.
>>
>>>
>>>
>>> There's a .range operator. Would that cover
>>> the top-most array index ?
>> Array? What array? Does Excel automatically create an array and put
>> these in it?
>> Ditto for "range.
>>
>> I think i found that ActiveSheet.Shapes(1).Select exists, and no other.
>> I know that ActiveSheet.Shapes("Picture 6").Select works, and that
>> ActiveSheet.Shapes("Picture 11").Select also works.
>> What s irking is that anything else creates an error and the Excel
>> OnError does NOT detect that error.
>> If it did,a loop counting from 1 to (say) 999 MIGHT find that third
>> item.
>>
>> That first "example" looks like one is creating an array arShapes,
>> but where in the hell did those names come from, what does each
>> element look like (do not trust names), and where did they come from?
>>
>> I suppose i could have 3 GIF files, and Insert From File to
>> successive cells; note no "range" command used, no array foo, and
>> certainly no names.
>>
>> This business is less clear than oily mud.
>> **
>> My relevant notes in the macro is:
>> 'With myDocument.Shapes.BuildFreeform(msoEditingCorner, 260, 150)
>> ' .AddNodes msoSegmentLine, msoEditingAuto, 400, 150
>> ' .AddNodes msoSegmentLine, msoEditingAuto, 400, 180
>> ' .AddNodes msoSegmentLine, msoEditingAuto, 260, 180
>> ' .AddNodes msoSegmentLine, msoEditingAuto, 260, 150
>> ' .ConvertToShape
>> 'End With
>> ' Have rectangle where i want the text
>> ' Select that new shape...
>> ' 'iobj.1 'for output display
>> ' 'iobj.2 'vertical jumper
>> ' 'iobj.3 'horizontal jumper
>> ' 'iobj.4 'smaller jumper <---i ASSUME this is added shape
>> ' so.. iobj.5 is new box
>> ' ActiveSheet.Shapes(5).Select 'yes, have box
>>
>> '*Do NOT need BuildFreeform
>> Labell = Range("J1").Text + "V"
>> Set sh = ActiveSheet.Shapes.AddShape _
>> (msoShapeRectangle, 260, 180, 150, 60)
>> sh.Fill.ForeColor.RGB = RGB(255, 255, 255)
>> sh.Fill.Visible = msoTrue 'False has same effect
>> sh.TextFrame.Characters.Text = Labell
>> sh.TextFrame.Characters.Font.Size = 36
>> sh.TextFrame.Characters.Font.Name = "Arial Black"
>> sh.TextFrame.Characters.Font.Bold = True
>> sh.TextFrame.Characters.Font.Color = vbRed
>>
>> 'With myDocument.Shapes.AddLine(260, 140, 120, 60).Line
>> ' .DashStyle = msoLineDashDotDot
>> ' .ForeColor.RGB = RGB(50, 0, 128)
>> 'End With
>>
>> sh.Line.DashStyle = msoLineDashDotDot
>> sh.Line.ForeColor.RGB = RGB(50, 0, 128)
>> '''
>> So,the third shape was made differently.
>> Above code partly stolen and partly via brute force from other
>> stolen code.
>> Certainly NOT from "examples" which essentially do not exist.
>>
>> Thanks.
>>
>>
>>>
>>> Paul
>>
>
> Here's another idea.
>
> https://stackoverflow.com/questions/32255992/how-do-i-list-all-existing-objects-in-an-excel-workbook-to-a-text-file
>
>
> Paul
The article was a bit confusing, but gave me some ideas.
And my in-program documentation concerning iobj.<number> which
realistically does not exist.
There is absolutely no way to access these objects 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
' found nature of each given shape by incremental use of this "filter"
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 added stuff 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.
[toc] | [prev] | [next] | [standalone]
| From | Jeroen Belleman <jeroen@nospam.please> |
|---|---|
| Date | 2017-11-08 09:12 +0100 |
| Message-ID | <otue94$1632$1@gioia.aioe.org> |
| In reply to | #10524 |
On 2017-11-08 07: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. There actually was an attached picture that made it through. That's the first time I see that in a Usenet article. Do we still need ASCII schematics? Jeroen Belleman
[toc] | [prev] | [next] | [standalone]
| From | Robert Baer <robertbaer@localnet.com> |
|---|---|
| Date | 2017-11-08 19:23 -0800 |
| Message-ID | <6TPMB.539$Pz4.313@fx15.iad> |
| In reply to | #10526 |
Jeroen Belleman wrote: > On 2017-11-08 07: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. > > There actually was an attached picture that made it through. > That's the first time I see that in a Usenet article. Do we > still need ASCII schematics? > > Jeroen Belleman Well, yes and no. This particular NG (alt.computer) is not configured for pictures and it does not encourage them. Most "normal" NGs are like this; the binaries NGs are the exception (like the alt.binaries.schematics.electronic).
[toc] | [prev] | [next] | [standalone]
| From | Martin Brown <'''newspam'''@nezumi.demon.co.uk> |
|---|---|
| Date | 2017-11-08 08:12 +0000 |
| Message-ID | <otue9v$1701$1@gioia.aioe.org> |
| In reply to | #10524 |
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 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. -- Regards, Martin Brown
[toc] | [prev] | [next] | [standalone]
| From | Robert Baer <robertbaer@localnet.com> |
|---|---|
| Date | 2017-11-08 19:41 -0800 |
| Message-ID | <W7QMB.7971$sC6.1410@fx35.iad> |
| In reply to | #10527 |
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.
>
> 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.
[toc] | [prev] | [next] | [standalone]
| From | Martin Brown <'''newspam'''@nezumi.demon.co.uk> |
|---|---|
| Date | 2017-11-09 08:33 +0000 |
| Message-ID | <ou13tm$2ds$1@gioia.aioe.org> |
| In reply to | #10531 |
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.
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
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.
I have only mirrored your coding style here to help you understand.
iobj.Select is redundant and pointless inside the loop
There are books about on coding in VBA I suggest you invest in one!
--
Regards,
Martin Brown
[toc] | [prev] | [next] | [standalone]
| From | Robert Baer <robertbaer@localnet.com> |
|---|---|
| Date | 2017-11-09 09:55 -0800 |
| Message-ID | <NE0NB.1633$Da3.816@fx39.iad> |
| In reply to | #10533 |
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". >
[toc] | [prev] | [next] | [standalone]
| From | Paul <nospam@needed.invalid> |
|---|---|
| Date | 2017-11-09 14:12 -0500 |
| Message-ID | <ou29ad$4s4$1@dont-email.me> |
| In reply to | #10535 |
Robert Baer wrote:
>> 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.
https://stackoverflow.com/questions/2916287/where-does-vba-debug-print-log-to
And there are likely to be other ideas here, like
objFile.writeline instead of Debug.Print.
https://stackoverflow.com/questions/32255992/how-do-i-list-all-existing-objects-in-an-excel-workbook-to-a-text-file
Paul
[toc] | [prev] | [next] | [standalone]
| From | Martin Brown <'''newspam'''@nezumi.demon.co.uk> |
|---|---|
| Date | 2017-11-09 20:20 +0000 |
| Message-ID | <ou2d9r$onv$1@gioia.aioe.org> |
| In reply to | #10537 |
On 09/11/2017 19:12, Paul wrote: > Robert Baer wrote: > >>> 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. > > https://stackoverflow.com/questions/2916287/where-does-vba-debug-print-log-to > > > And there are likely to be other ideas here, like > objFile.writeline instead of Debug.Print. > > https://stackoverflow.com/questions/32255992/how-do-i-list-all-existing-objects-in-an-excel-workbook-to-a-text-file > > > Paul He's a clueless fuckwit totally out of his depth. Hasn't even discovered the "Immediate" debug window. ISTR Shortcut crtl-G ought to bring it up. -- Regards, Martin Brown
[toc] | [prev] | [next] | [standalone]
| From | Robert Baer <robertbaer@localnet.com> |
|---|---|
| Date | 2017-11-10 17:15 -0800 |
| Message-ID | <FasNB.2235$Da3.1676@fx39.iad> |
| In reply to | #10537 |
Paul wrote: > Robert Baer wrote: > >>> 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. > > https://stackoverflow.com/questions/2916287/where-does-vba-debug-print-log-to * THAT is in (eXplicitly VBA, NOT n Excel (which does not have those "windows". > > > > And there are likely to be other ideas here, like objFile.writeline > instead of Debug.Print. > > https://stackoverflow.com/questions/32255992/how-do-i-list-all-existing-objects-in-an-excel-workbook-to-a-text-file * They sure make it look like Excel, but that function is implemented only in VBA. > > > > Paul I think what Martin fails to realize is that the program VBA is NOT Excel and vice-versa. In most cases, language statements to do a certain thing are the same, but there are some cases where some functions/methods/etc exist in only one or are implemented in a totally different way. Seems StackOverflow has fallen into the same trap.
[toc] | [prev] | [next] | [standalone]
| From | Martin Brown <'''newspam'''@nezumi.demon.co.uk> |
|---|---|
| Date | 2017-11-13 16:32 +0000 |
| Message-ID | <ouchf2$1v08$1@gioia.aioe.org> |
| In reply to | #10539 |
On 11/11/2017 01:15, Robert Baer wrote: > Paul wrote: >> Robert Baer wrote: >> >>>> 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. >> >> https://stackoverflow.com/questions/2916287/where-does-vba-debug-print-log-to >> > * THAT is in (eXplicitly VBA, NOT n Excel (which does not have those > "windows". *NO* it isn't and *YES* it does. You are thicker than pig shit. What ancient version of XL are you running? Pre 97 or something? > I think what Martin fails to realize is that the program VBA is NOT > Excel and vice-versa. I program Excel from time to time. The example I gave works in XL2010 VBA 7.0 without any problems. There might be some tweaks needed for previous versions but nothing there strikes me as non-portable. > In most cases, language statements to do a certain thing are the > same, but there are some cases where some functions/methods/etc exist in > only one or are implemented in a totally different way. > > Seems StackOverflow has fallen into the same trap. If you look closely at the screen print you will see that it is a part of the "View" menu list for XL Developers window. They even give the helpful suggestion of displaying an output string in a msgbox if you want to halt execution. -- Regards, Martin Brown
[toc] | [prev] | [standalone]
Back to top | Article view | alt.computer
csiph-web