Rabu, 31 Desember 2014

Sv: [ExcelVBA] Detect which shape "starts" a macro

 

Thanks to both Tim, Derek and Bob!

This gave me a useful hint to use macros with shapes.

I also found another approaach:

I sometimes create shapes with VBA.

I found this code somewhere that creates a shape, which has a macro (macroname) assigned and that macro brings a parameter (variable text) that can identify which shape has started the macro.


    ActiveSheet.Shapes.AddShape(msoShapeFlowchartSummingJunction, l, t, w, h).Select
    Selection.OnAction = "'macroname """ & text & """'"
   
This is better descibed in:


Hope this can be useful for you!

This is surely my last mail in this group this year!

Happy new year to all of you!

regards

Torstein



Den Onsdag, 31. desember 2014 14.09 skrev "'Bob Phillips' bob.phillips@dsl.pipex.com [ExcelVBA]" <ExcelVBA@yahoogroups.com>:


 
Use Application.Caller
 
 
From: ExcelVBA@yahoogroups.com [mailto:ExcelVBA@yahoogroups.com]
Sent: 21 December 2014 16:26
To: ExcelVBA@yahoogroups.com
Subject: [ExcelVBA] Detect which shape "starts" a macro
 
 
In a worksheet there are several shapes.
 
They are all assigned to the same macro.
 
Is it possible in the macro to detect which skape that was "clicked on" to start the macro?
 
I wish the macro to do different tasks dependent on which shape that started it!
 
Is there a sort of activeShape object?
 
Regards and Merry Christmas to all of you Excelers!
 
Torstein Johnsen


__._,_.___

Posted by: Torstein Johnsen <sejohnse@yahoo.no>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (6)
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------

.

__,_._,___

Tidak ada komentar:

Posting Komentar