Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding buttons and connect macro
Lars,
I do not what code you have to zoom in and out, but all you need is a simple Boolean variable to determine whether its small or large diagram. Something like Dim fDiagram1 as Boolean Dim fDiagram2 As Boolean etc. Sub Zoom() If fDiagram1 = True Then Call ZoomOutDiagram1 Else Call ZoomInDaigram1 End If fDiagram1 = Not fDiagram1 End Sub Get the idea? -- HTH ------- Bob Phillips ... looking out across Poole Harbour to the Purbecks "Lars Peter Nielsen" wrote in message k... Hi First of all I will le´t you know I am from Denmark, so I am sry. about my english. Here is what I have made: I have this workbook whith up to 10 sheets. On each sheet I have 4 diagrams fitted so I can see them at once. Then I have made macros, so when I click on a diagram it will zoom out, so this particular diagram fits the whole screen (so you can see details better). Also made macros, so when I run it, the diagrams zooms back in (back to start - with all 4 diagrams at the same place). What I need is when I click on 1 diagram and zooms out - the code should also create a button whit my zoom in macro, so when I click on that one it will zoom back. If this is possible I also need the code to delete the button, which I could put into my zoom in macro. Maybe there is an easier way, pls. let me know. I was thinking, maybe it was possible to create the macro, so when I click on the diagram and it zooms out, then the macro change on the diagram, so next time when I click on it - it zooms in (run my zoom in macro). I dont know if you understand my problem. Regards Lars |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding buttons and connect macro
Hi
First of all I will le´t you know I am from Denmark, so I am sry. about my english. Here is what I have made: I have this workbook whith up to 10 sheets. On each sheet I have 4 diagrams fitted so I can see them at once. Then I have made macros, so when I click on a diagram it will zoom out, so this particular diagram fits the whole screen (so you can see details better). Also made macros, so when I run it, the diagrams zooms back in (back to start - with all 4 diagrams at the same place). What I need is when I click on 1 diagram and zooms out - the code should also create a button whit my zoom in macro, so when I click on that one it will zoom back. If this is possible I also need the code to delete the button, which I could put into my zoom in macro. Maybe there is an easier way, pls. let me know. I was thinking, maybe it was possible to create the macro, so when I click on the diagram and it zooms out, then the macro change on the diagram, so next time when I click on it - it zooms in (run my zoom in macro). I dont know if you understand my problem. Regards Lars |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding buttons and connect macro
Lars,
why not use activewindow.zoom ? less elegant.. but simple :) keepITcool < email : keepitcool chello nl (with @ and .) < homepage: http://members.chello.nl/keepitcool "Lars Peter Nielsen" wrote: Hi Bob I have a code like this - just the principle - not the exact code cause it is at work: ActiveSheet.Shapes("Diagram 1").ScaleWidth 1.39, msoFalse, msoScaleFromTopLeft ActiveSheet.Shapes("Diagram 1").ScaleHeight 1.61, msoFalse, _ msoScaleFromTopLeft ActiveWindow.Visible = False Range("I29").Select Will it work? I think I get your thinking. Should I then make a zoom macro (like the one you write) for each sheet? LPN |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding buttons and connect macro
Lars,
Yes it will work, just need to adapt to suit. It would go something like Dim fDiagram1 as Boolean Dim fDiagram2 As Boolean etc. Sub Zoom() fDiagram1 = ZoomDiagram(1, fDiagram1) fdiagram2 = ZoomDiagram(2, fdiagram2) 'etc. End Sub Function ZoomDiagram(Diagram As Long, ZoomIn As Boolean) As Boolean With ActiveSheet.Shapes("Diagram" & Diagram) If ZoomIn Then .ScaleWidth 1.61, msoFalse, msoScaleFromTopLeft Else .ScaleHeight 1.39, msoFalse, msoScaleFromTopLeft End If End With ActiveWindow.Visible = False Range("I29").Select ZoomDiagram = Not ZoomIn End Function This will work from any sheet as long as it is the activesheet, and as long as the Diaghrams are all called Daigram 1, Diagram 2, etc, whatever the sheet. -- HTH Bob Phillips "Lars Peter Nielsen" wrote in message k... Hi Bob I have a code like this - just the principle - not the exact code cause it is at work: ActiveSheet.Shapes("Diagram 1").ScaleWidth 1.39, msoFalse, msoScaleFromTopLeft ActiveSheet.Shapes("Diagram 1").ScaleHeight 1.61, msoFalse, _ msoScaleFromTopLeft ActiveWindow.Visible = False Range("I29").Select Will it work? I think I get your thinking. Should I then make a zoom macro (like the one you write) for each sheet? LPN "Bob Phillips" skrev i en meddelelse ... Lars, I do not what code you have to zoom in and out, but all you need is a simple Boolean variable to determine whether its small or large diagram. Something like Dim fDiagram1 as Boolean Dim fDiagram2 As Boolean etc. Sub Zoom() If fDiagram1 = True Then Call ZoomOutDiagram1 Else Call ZoomInDaigram1 End If fDiagram1 = Not fDiagram1 End Sub Get the idea? -- HTH ------- Bob Phillips ... looking out across Poole Harbour to the Purbecks "Lars Peter Nielsen" wrote in message k... Hi First of all I will le´t you know I am from Denmark, so I am sry. about my english. Here is what I have made: I have this workbook whith up to 10 sheets. On each sheet I have 4 diagrams fitted so I can see them at once. Then I have made macros, so when I click on a diagram it will zoom out, so this particular diagram fits the whole screen (so you can see details better). Also made macros, so when I run it, the diagrams zooms back in (back to start - with all 4 diagrams at the same place). What I need is when I click on 1 diagram and zooms out - the code should also create a button whit my zoom in macro, so when I click on that one it will zoom back. If this is possible I also need the code to delete the button, which I could put into my zoom in macro. Maybe there is an easier way, pls. let me know. I was thinking, maybe it was possible to create the macro, so when I click on the diagram and it zooms out, then the macro change on the diagram, so next time when I click on it - it zooms in (run my zoom in macro). I dont know if you understand my problem. Regards Lars |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding buttons and connect macro
Thx. I will try to make it work...
LPN "Bob Phillips" skrev i en meddelelse ... Lars, Yes it will work, just need to adapt to suit. It would go something like Dim fDiagram1 as Boolean Dim fDiagram2 As Boolean etc. Sub Zoom() fDiagram1 = ZoomDiagram(1, fDiagram1) fdiagram2 = ZoomDiagram(2, fdiagram2) 'etc. End Sub Function ZoomDiagram(Diagram As Long, ZoomIn As Boolean) As Boolean With ActiveSheet.Shapes("Diagram" & Diagram) If ZoomIn Then .ScaleWidth 1.61, msoFalse, msoScaleFromTopLeft Else .ScaleHeight 1.39, msoFalse, msoScaleFromTopLeft End If End With ActiveWindow.Visible = False Range("I29").Select ZoomDiagram = Not ZoomIn End Function This will work from any sheet as long as it is the activesheet, and as long as the Diaghrams are all called Daigram 1, Diagram 2, etc, whatever the sheet. -- HTH Bob Phillips "Lars Peter Nielsen" wrote in message k... Hi Bob I have a code like this - just the principle - not the exact code cause it is at work: ActiveSheet.Shapes("Diagram 1").ScaleWidth 1.39, msoFalse, msoScaleFromTopLeft ActiveSheet.Shapes("Diagram 1").ScaleHeight 1.61, msoFalse, _ msoScaleFromTopLeft ActiveWindow.Visible = False Range("I29").Select Will it work? I think I get your thinking. Should I then make a zoom macro (like the one you write) for each sheet? LPN "Bob Phillips" skrev i en meddelelse ... Lars, I do not what code you have to zoom in and out, but all you need is a simple Boolean variable to determine whether its small or large diagram. Something like Dim fDiagram1 as Boolean Dim fDiagram2 As Boolean etc. Sub Zoom() If fDiagram1 = True Then Call ZoomOutDiagram1 Else Call ZoomInDaigram1 End If fDiagram1 = Not fDiagram1 End Sub Get the idea? -- HTH ------- Bob Phillips ... looking out across Poole Harbour to the Purbecks "Lars Peter Nielsen" wrote in message k... Hi First of all I will le´t you know I am from Denmark, so I am sry. about my english. Here is what I have made: I have this workbook whith up to 10 sheets. On each sheet I have 4 diagrams fitted so I can see them at once. Then I have made macros, so when I click on a diagram it will zoom out, so this particular diagram fits the whole screen (so you can see details better). Also made macros, so when I run it, the diagrams zooms back in (back to start - with all 4 diagrams at the same place). What I need is when I click on 1 diagram and zooms out - the code should also create a button whit my zoom in macro, so when I click on that one it will zoom back. If this is possible I also need the code to delete the button, which I could put into my zoom in macro. Maybe there is an easier way, pls. let me know. I was thinking, maybe it was possible to create the macro, so when I click on the diagram and it zooms out, then the macro change on the diagram, so next time when I click on it - it zooms in (run my zoom in macro). I dont know if you understand my problem. Regards Lars |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Adding buttons to a new menu bar | Excel Worksheet Functions | |||
Adding Customised Buttons to a toolbar | Excel Discussion (Misc queries) | |||
Adding value to option buttons | Excel Discussion (Misc queries) | |||
Customising Macro Buttons, Adding an image in excel | New Users to Excel | |||
I am trying to connect web page to excel but buttons are displaye. | Excel Discussion (Misc queries) |