Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding buttons to a new menu bar Greegan Excel Worksheet Functions 1 April 7th 06 07:55 AM
Adding Customised Buttons to a toolbar GLT Excel Discussion (Misc queries) 6 March 22nd 06 06:32 AM
Adding value to option buttons jodieg Excel Discussion (Misc queries) 3 November 29th 05 11:25 PM
Customising Macro Buttons, Adding an image in excel Baz New Users to Excel 1 July 3rd 05 05:22 PM
I am trying to connect web page to excel but buttons are displaye. Nizar Dayani Excel Discussion (Misc queries) 0 January 14th 05 07:13 AM


All times are GMT +1. The time now is 04:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"