F
Frankenroc
Greetings,
I'm basically using a plug in that creates a menu structure, and then
going into Excel and VB, creates a menu dynamically. The menu consists
of pictures, text boxes, and lines (looking like a hierarchy tree, for
example). Now, for simplicity sake, let's just say pictures, since
that's where the problem arised.
Basically, I use the command
Code:
--------------------
ActiveSheet.Pictures.Insert( [picture location here] ).Select
--------------------
to insert my picture. From there, it renames the picture to what I
want so when the macro is assigned, it can figure out which picture the
user clicked on so it can take the appropriate action.
When the picture is clicked, the VBA figures out what it needs to do,
and usually it destroys the menu it created and makes a new one. The
problem arose after extensive testing when, all of a sudden, the macro
could no longer select the file. It would insert the picture, but
couldn't select it using the same code that had worked before.
Figured out that it has something to do with the names automatically
assigned by Excel when a picture is inserted. The latest picture it
created was named "Picture 65536," and I'm sure you realize the
significance of that number. (2^16) Of course, I'd like to rename
this picture, but I need to get past this automatically assigned name
that Excel gives to it. Is there a way to reset this number or set it
to a certain amount?
I'm almost certain the number is stored somewhere on the sheet itself.
If I take this code to another sheet the "counter" is reset, and I've
done that as a temporary measure so I can continue working with and
testing the menu system. Also, even after a complete reboot of the
machine, I notice the auto-assigned number in the object name is at the
same level it was before. So I'm thinking I just need a way to access
that counter embedded in the sheet... any ideas?
I'm basically using a plug in that creates a menu structure, and then
going into Excel and VB, creates a menu dynamically. The menu consists
of pictures, text boxes, and lines (looking like a hierarchy tree, for
example). Now, for simplicity sake, let's just say pictures, since
that's where the problem arised.
Basically, I use the command
Code:
--------------------
ActiveSheet.Pictures.Insert( [picture location here] ).Select
--------------------
to insert my picture. From there, it renames the picture to what I
want so when the macro is assigned, it can figure out which picture the
user clicked on so it can take the appropriate action.
When the picture is clicked, the VBA figures out what it needs to do,
and usually it destroys the menu it created and makes a new one. The
problem arose after extensive testing when, all of a sudden, the macro
could no longer select the file. It would insert the picture, but
couldn't select it using the same code that had worked before.
Figured out that it has something to do with the names automatically
assigned by Excel when a picture is inserted. The latest picture it
created was named "Picture 65536," and I'm sure you realize the
significance of that number. (2^16) Of course, I'd like to rename
this picture, but I need to get past this automatically assigned name
that Excel gives to it. Is there a way to reset this number or set it
to a certain amount?
I'm almost certain the number is stored somewhere on the sheet itself.
If I take this code to another sheet the "counter" is reset, and I've
done that as a temporary measure so I can continue working with and
testing the menu system. Also, even after a complete reboot of the
machine, I notice the auto-assigned number in the object name is at the
same level it was before. So I'm thinking I just need a way to access
that counter embedded in the sheet... any ideas?