Macro-calling shape

Hello,

can the actual macro-calling shape be identified when there are 2 shapes 
assigned to the same VBA-procedure ?

Thank you in advance.

Regards,

hglamy



0
H
1/27/2010 2:56:41 PM
excel.programming 6508 articles. 2 followers. Follow

3 Replies
1170 Views

Similar Articles

[PageSpeed] 17

Try:

msgbox application.caller

You'll see the name of the shape that's calling the macro...

You can use:

dim myShape as shape
set myshape = activesheet.shapes(application.caller)

then use all the properties for that shape

msgbox myshape.name & vblf & myshape.topleftcell.address & ...

"H.G. Lamy" wrote:
> 
> Hello,
> 
> can the actual macro-calling shape be identified when there are 2 shapes
> assigned to the same VBA-procedure ?
> 
> Thank you in advance.
> 
> Regards,
> 
> hglamy

-- 

Dave Peterson
0
Dave
1/27/2010 3:35:36 PM
Sub dural()
MsgBox Application.Caller
End Sub

-- 
Gary''s Student - gsnu201001


"H.G. Lamy" wrote:

> Hello,
> 
> can the actual macro-calling shape be identified when there are 2 shapes 
> assigned to the same VBA-procedure ?
> 
> Thank you in advance.
> 
> Regards,
> 
> hglamy
> 
> 
> 
> .
> 
0
Utf
1/27/2010 3:42:05 PM
Thank you, Dave

hgl

"Dave Peterson" <petersod@verizonXSPAM.net> wrote in message 
news:4B605D48.BC93B8CB@verizonXSPAM.net...
> Try:
>
> msgbox application.caller
>
> You'll see the name of the shape that's calling the macro...
>
> You can use:
>
> dim myShape as shape
> set myshape = activesheet.shapes(application.caller)
>
> then use all the properties for that shape
>
> msgbox myshape.name & vblf & myshape.topleftcell.address & ...
>
> "H.G. Lamy" wrote:
>>
>> Hello,
>>
>> can the actual macro-calling shape be identified when there are 2 shapes
>> assigned to the same VBA-procedure ?
>>
>> Thank you in advance.
>>
>> Regards,
>>
>> hglamy
>
> -- 
>
> Dave Peterson 


0
H
1/27/2010 3:47:04 PM
Reply:

Similar Artilces:

run macro after userform unloads
I have a complicated userform contained within a template. Once the userform is completed and the OK command button is selected the userform merges and populates. Within the template I have a series of cross references which I would like updated once the document populates although I'm not sure how to do this as the form unloads and then the document populates. Can someone please shed any light on how I might update fields once the template is has populated? Basically after the following is completed, then I want do something simple like a print preview so the cross...

"divide a shape for text"
ive made a simple flow chart and need to have the main shape divided so that written text can be viewed side by side, in the same "shape". nero Wrote: > ive made a simple flow chart and need to have the main shape divided so > that > written text can be viewed side by side, in the same "shape". Just put 2 free form text boxes side by side on top of the shape -- Mallycat ------------------------------------------------------------------------ Mallycat's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=35514 View this thread: http...

automatic phone call
Regards How to create automatic phone calls and assign to user? Thanks I am not sure if i understood it ! Well you can use workflow and do it . ------ Aamir Blog : http://mscrmsupport.wordpress.com/ ...

Unable to Record Macro
Never had a problem recording macros before, but now I'm getting the warning box "Unable To Record". My other macros still run, but I cannot record a new one. Any help &/or suggestions would be greatly appreciated. Thanks, Steve Try this link:- http://support.microsoft.com/default.aspx?scid=kb;en-us;166492 XL97: "Unable to Record" Message When Recording a Macro -- Regards Ken....................... Microsoft MVP - Excel Sys Spec - Win XP Pro / XL2K & XLXP -----------------------------------------------------------------...

macro that runs only when workbook is created
Can anyone tell me if excel has this capability built in? I know in word you can create a autonew macro that only runs when the document is created (doesn=92t run when reopened). Is this possible in excel. Using excel 2007. I want to create a new workbook from a template and I would like to have a macro run when the workbook is created. Thanks for any advice. BRC You need to use Application level events. In the ThisWorkbook code module, paste the following: Private WithEvents App As Excel.Application Private Sub App_NewWorkbook(ByVal Wb As Workbook) MsgBox "New Work...

Inactive UNDO REDo button due to a macro
I have created a Pivot table and to dynamically calculate a calculated field depending upon the selection in a page field I have written a small piece of VBA code in Worksheet_Calculate event. But this disables/deactivates Undo/Redo button at the top. I have noticed that if I remove this macro I get this button back. Can any body suggest how to get it back? Regards Lots of macros kill the Undo/Redo stack. My bet is that your macro is one of them. Priya wrote: > > I have created a Pivot table and to dynamically calculate a calculated > field depending upon the selection in a pa...

Macros for Morons
So I've been given some macro texts as a way to solve various problems. However, I am a macro moron and don't even know how to use the text I've received. If it isn't too much trouble, can someone explain how to use a macro and how to enter the macro codes I've received? Thanks for any help. Hi have a look at http://www.mvps.org/dmcritchie/excel/getstarted.htm for some instructions how to use macros -- Regards Frank Kabel Frankfurt, Germany Lucas Ford wrote: > So I've been given some macro texts as a way to solve various > problems. However, I am a macro m...

PivotChart formatting: macro for multiple unique charts
Hi � I've used this group as a resource often over the last couple years, but have never needed to post because someone else had always already asked and gotten an answer to my question. Now I'm struggling with a formatting issue using PivotCharts and would really appreciate some insight. I'm creating a large number of different PivotCharts, and I'd like to be able to format the series in them automatically. My charts have different numbers of series on them, though they all contain the same pool of series. What I'd like to be able to do is tell Excel to format the indi...

How to add to a macro
Is it possible to add a recording to an existing macro? The only way I have been able to to so this is to create another recording and then copy the code from the addition and paste it into the first macro. It just seems there should be an easier way. Thanks, Joe M. Hi, the best way is to write the macro from the beginning as per your explanation that is the only way you have to add something to the macro "Joe M." wrote: > Is it possible to add a recording to an existing macro? The only way I have > been able to to so this is to create another recording a...

Cannot drag a shape
Hello, I'm using Visio 2003. I cannot drag a shape from the shapes Windows unto the drawing. However I can copy and paste it there. But once it's there, I can only resize it but not drag it anywhere. Any ideas? Seems like there is a protection or shape lock somewhere. I've been through all the menus and couldn't figure it out. Thanks in advance. On Tue, 13 May 2008 13:57:02 -0700, Ju-Man <JuMan@discussions.microsoft.com> wrote: >Hello, >I'm using Visio 2003. I cannot drag a shape from the shapes Windows unto the >drawing. However I can copy and paste i...

Macro "on off" switch
I have a very simple macro assigned to a button that unhides a sheet Sub HR_Training() ' ' HR_Training Macro ' Unhide only the HR Training Hard Dollar Cost Savings Sheet ' ' Application.ScreenUpdating = False Sheets("HR - Training").Visible = True Sheets("Selection Sheet").Select End Sub -- What I would like to do is add a "toggle" type of functionality so that the first press of the button will unhide the sheet, and the next time it will hide it.. any help would be most appreciated.. Thanks Larry ...

macro which finds last cell in a column
please help me by telling a macro which finds last cell in a column thank -- Message posted from http://www.ExcelForum.com Dim LastRow as Long LastRow = Range("A65536").End(xlUp).Row or if you just want to select it: Range("A65536").End(xlUp).Select Regards Trevor "vikram >" <<vikram.15hp0w@excelforum-nospam.com> wrote in message news:vikram.15hp0w@excelforum-nospam.com... > please help me by telling a macro which finds last cell in a column > > thanks > > > --- > Message posted from http://www.ExcelForum.com/ > ...

Passing variables between a form and macro #2
Hi I have a working Excel VBA macro and would like to use a form for all the inputs. I have the form and the code behind the text/combo boxes etc. I just don't know how to call the form so that the data collected is passed to the variables in the main macro. I searched for this information but can only find info on creating the form rather than having it run with a macro. I'd appreciate any info, links etc. It would be great if you could point me to an example form with all the suurounding code, declarations etc. Can the form be used for the output of the macro? Thanks David ...

entering call option into Money
I have a 100 share position in Dow Chemical. I have sold 1 Call option on that Dow Chemical stock. When I try to enter the call into Money, I can't because I am entering a sell of a position before I have entered a buy. Is there a way to enter this call into Money so that I can track it until I buy it back, or it expires? In microsoft.public.money, Brooks wrote: >I have a 100 share position in Dow Chemical. I have sold >1 Call option on that Dow Chemical stock. When I try to >enter the call into Money, I can't because I am entering a >sell of a position befor...

free calls to INDIA and UK
Hello, I wish to make free calls from my PC to INDIA and UK. Please suggest the best options. Thanks in advance! - Saral saral wrote on 01/27/2010 08:01 : > Hello, > > I wish to make free calls from my PC to INDIA and UK. Please suggest the best > options. > > Thanks in advance! > > - Saral i would suggest to just check FreeVcalls... http://FreeVcalls.blogspot.com They publish all the latest offers for making free or cheapest calls to INDIA... Recently they have published the cheapest ever offer of .0039 US cent/min to INDIA... Just...

Macros making my spreadsheets too large
After using macros, I have noticed that some very small files (20-30kb) are now 2-3MB! There is very little data in my spreadsheet, so I am assuming that it has something to do with the Macros. Is there any way to compress my spreadsheet, or some other way to fix this? ZAPPER Most common reason for workbook bloat is that Excel thinks the "used range" in sheets is larger than it has to be and what you think it is. Select a sheet and do a CRTL + END to see what Excel thinks is end of data range. Could be your macros are making the "used range" on the sheets much larger ...

Macro from cell specific to whole column
Hello All, I have recorded the following macro... ActiveCell.FormulaR1C1 = "=RIGHT(RC[-3],1)" Range("O286").Select ActiveCell.FormulaR1C1 = "=IF(RC[-1]=""-"",(LEFT(RC[-4],15)*-1),RC[-4])" that basically takes a text stored number such as 100.54- to -100.54. What I want to do is make this auto fill for the entire column. How should rewrite it? -- Thanks for all of the help. It is much appreciated!!!! On May 26, 5:06=A0am, Bean Counter <BeanCoun...@discussions.microsoft.com> wrote: > Hello All, > ...

Another Macro Problem! (dave where are you!)
Okay, You guys have helped me in the past, and I need you again. I am using Excel 2000. I have a worksheet that I saved as a template. The user opens the template and clicks a button that executes the macro. When the button is pushed the open box appears and you select the files that you need and hit open and then it opens the files one after anpther. When it finishes opening the files (up to 250) I click on the first page of my workbook "Summary". These is where is all the information is summarized from all of the 250 or so files that are now open in the workbook. I save this...

How to run a macro if I don't know the name in advance
I am trying to create a macro on the fly using vb code from an existing file, and then run the Macro that was just created. Is there a way to find out the name of a Macro programmatically so that I can pass it to the Application.Run method? Maybe: myMacroName = Application.Dialogs(xlDialogMacroOptions).Show "Himanshu" <Himanshu@discussions.microsoft.com> wrote in message news:B140EF14-FF81-4E25-B1E2-8CD6EF813F56@microsoft.com... >I am trying to create a macro on the fly using vb code from an existing >file, > and then run the Macro tha...

AutoRun Macro
Can some one tell me how to run a macro as soon as the sheet is opened. I have a box which needs to be filled using Add.item when the sheet opens. The Additem routine works correctly when I click the button for it, but I want to dispense with the button. Thank you in advance. -- jee22@msm.cam.ac.uk Materials Science & Metallurgy Ext 34346 Hi you can use a workbook event for this. If you mean the file openening use the workbook_open event >-----Original Message----- >Can some one tell me how to run a macro as soon as the sheet is opened. I >have a box which needs to be fi...

Macro commands to assign colors to each line in an Excel chart.
Is there a macro command that will assign a user specifide color to each individual line of a scatter graph? Hi, First, scatter charts do not usually display as lines, so when you say line what do you mean? You chosen as style with connecting lines? or you are refering to drop lines, or error bar lines, or...? You can tell Excel to vary the color by point but if you want to assign specific colors to specific points you will need to write a macro. What version of Excel are you using? -- If this helps, please click the Yes button. Cheers, Shane Devenshire "JohnnyC" wr...

Antivirus for Macros in Excel 97
First time here. Sorry if this has been covered or is in a FAQ but I searched and didn't find the answer. I have Excel 97 and want to know the easiest (read: automatic?) way to check macros for viruses. It's some examples I've downloaded from sites that I can probably trust but..you never know. I have avast! scanner (free version). I suppose if you download the file in XLS format it would check it? But most come in ZIP files. Do I have to manually run the unzipped macro through the scanner to check for viruses or is there a way to tell Excel (or the scanner) when I open a f...

No macro recording dialog box
When I record a macro, I no longer get the macro recording dialog box. I can stop the macro from tools/macro/stop recording. However without the dialog box I cannot choose relative reference. I use to have this box. Hi Steve! Right click any toolbar. Select Customize. On the Toolbars Tab, scroll down and check Stop Recording. Close. If you are recording a macro and use the "X" to close the toolbar instead of using the blue stop button, the toolbar will no longer appear. Biff >-----Original Message----- >When I record a macro, I no longer get the macro recording >...

Error Running a Macro
Dear members,I am quite fresh using macros.Therefore,I would like you to be patient: A. Situation: I recorded a macro that must open a dataform where I can see information about a small database in Excel, but when I run it, it tells me that there is a mistake, then I debugged the macro and found out this in the code Sub LoadDataForm() ' ' LoadDataForm Makro ' Makro am 7/28/2005 von Vidal A. Castillo aufgezeichnet ' Range("A4").Select Range(Selection, Selection.End(xlDown)).Select Range("A4:V1366").Select ActiveSheet.ShowDataForm End Sub ...

Calling the Row Number?
I'm using the following function: =HLOOKUP("350305",PIVOT,2,FALSE) When I try to copy it down a column, the function doesn't change a all, but I want the number "2" to reflect what row the function is on Is this possible without making another column with number 1,2,3...etc -- Message posted from http://www.ExcelForum.com Use ROW(2:2) instead of 2 -- Regards, Peo Sjoblom "gorkyness >" <<gorkyness.15hljq@excelforum-nospam.com> wrote in message news:gorkyness.15hljq@excelforum-nospam.com... > I'm using the following function: ...