Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|