![]() |
what is my self?
Hi!
Once someone helped me to do so: Set MyFile = Workbooks.Open(file1) - myfile becomes an object I can work with. (thanks!) but how do I get the place, where my button is - the sheet, on which the event is triggered? BR Sonnich |
what is my self?
Can you not just use ActiveSheet?
-- HTH Bob Phillips (replace somewhere in email address with googlemail if mailing direct) "Sonnich" wrote in message ups.com... Hi! Once someone helped me to do so: Set MyFile = Workbooks.Open(file1) - myfile becomes an object I can work with. (thanks!) but how do I get the place, where my button is - the sheet, on which the event is triggered? BR Sonnich |
what is my self?
Is this a commandbutton from the control toolbox toolbar?
And is your code behind that worksheet? msgbox me.name would give you the name of the sheet that holds the code. or application.goto me.range("a1") to return to A1 of that sheet. ====== If you're using a button from the Forms toolbar: Dim ActSheet as worksheet set actsheet = activesheet 'do lots of stuff 'and you can refer to that variable application.goto actsheet.range("a1") 'or whatever Sonnich wrote: Hi! Once someone helped me to do so: Set MyFile = Workbooks.Open(file1) - myfile becomes an object I can work with. (thanks!) but how do I get the place, where my button is - the sheet, on which the event is triggered? BR Sonnich -- Dave Peterson |
what is my self?
no, when I use
Set MyFile = Workbooks.Open(file1) it might be something else Bob Phillips wrote: Can you not just use ActiveSheet? -- HTH Bob Phillips (replace somewhere in email address with googlemail if mailing direct) "Sonnich" wrote in message ups.com... Hi! Once someone helped me to do so: Set MyFile = Workbooks.Open(file1) - myfile becomes an object I can work with. (thanks!) but how do I get the place, where my button is - the sheet, on which the event is triggered? BR Sonnich |
what is my self?
Dave Peterson wrote: Is this a commandbutton from the control toolbox toolbar? It is a button on a sheet. And is your code behind that worksheet? Set MyFile = Workbooks.Open(file1) Set AnotherFile = Workbooks.Open(file1) MyFile.DoSomething; blabla blabla PrintSomethingToSheetWithButton end; msgbox me.name would give you the name of the sheet that holds the code. causes "invalud used of keyword "me" or application.goto me.range("a1") to return to A1 of that sheet. ====== If you're using a button from the Forms toolbar: Dim ActSheet as worksheet set actsheet = activesheet 'do lots of stuff 'and you can refer to that variable application.goto actsheet.range("a1") 'or whatever Sonnich wrote: Hi! Once someone helped me to do so: Set MyFile = Workbooks.Open(file1) - myfile becomes an object I can work with. (thanks!) but how do I get the place, where my button is - the sheet, on which the event is triggered? BR Sonnich -- Dave Peterson |
what is my self?
Save it before the Open
Set btnSheet = ActiveSheet -- HTH Bob Phillips (replace somewhere in email address with googlemail if mailing direct) "Sonnich" wrote in message oups.com... no, when I use Set MyFile = Workbooks.Open(file1) it might be something else Bob Phillips wrote: Can you not just use ActiveSheet? -- HTH Bob Phillips (replace somewhere in email address with googlemail if mailing direct) "Sonnich" wrote in message ups.com... Hi! Once someone helped me to do so: Set MyFile = Workbooks.Open(file1) - myfile becomes an object I can work with. (thanks!) but how do I get the place, where my button is - the sheet, on which the event is triggered? BR Sonnich |
what is my self?
There are two types of buttons you can use on a worksheet--one is from the
Control toolbox toolbar and the other is from the Forms tooblar. My previous post had two different suggestions--one for each type button. Sonnich wrote: Dave Peterson wrote: Is this a commandbutton from the control toolbox toolbar? It is a button on a sheet. And is your code behind that worksheet? Set MyFile = Workbooks.Open(file1) Set AnotherFile = Workbooks.Open(file1) MyFile.DoSomething; blabla blabla PrintSomethingToSheetWithButton end; msgbox me.name would give you the name of the sheet that holds the code. causes "invalud used of keyword "me" or application.goto me.range("a1") to return to A1 of that sheet. ====== If you're using a button from the Forms toolbar: Dim ActSheet as worksheet set actsheet = activesheet 'do lots of stuff 'and you can refer to that variable application.goto actsheet.range("a1") 'or whatever Sonnich wrote: Hi! Once someone helped me to do so: Set MyFile = Workbooks.Open(file1) - myfile becomes an object I can work with. (thanks!) but how do I get the place, where my button is - the sheet, on which the event is triggered? BR Sonnich -- Dave Peterson -- Dave Peterson |
All times are GMT +1. The time now is 12:40 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com