Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default How do I stop Macro from affect other Workbooks

I am trying to create a 'simple' macro in Excel2003 that will Zoom everysheet
to 128% (to allow for different user screen resolutions). I have a macro
that works but it also does any other (non-minimised) spreadsheet that is
open.

Can anyone tell me what I need to add to restrict it to the current
workbook. (NB the user is free to rename the workbook so I can not hard
program the file name in).

Sub Big()
ActiveWindow.WindowState = xlMinimized
Dim I As Integer
For I = 1 To Sheets.Count
Sheets(I).Select
ActiveWindow.Zoom = True
ActiveWindow.Zoom = 128
Next
ActiveWindow.WindowState = xlMaximized
End Sub

Many thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default How do I stop Macro from affect other Workbooks

Possibly:

Sub Big()
Application.ScreenUpdating = False
Dim I As Integer
For I = 1 To ActiveWorkbook.Sheets.Count
Sheets(I).Select
ActiveWindow.Zoom = True
ActiveWindow.Zoom = 128
Next
Application.ScreenUpdating = True
End Sub



--
Regards,
Tom Ogilvy



"B Baggins" wrote:

I am trying to create a 'simple' macro in Excel2003 that will Zoom everysheet
to 128% (to allow for different user screen resolutions). I have a macro
that works but it also does any other (non-minimised) spreadsheet that is
open.

Can anyone tell me what I need to add to restrict it to the current
workbook. (NB the user is free to rename the workbook so I can not hard
program the file name in).

Sub Big()
ActiveWindow.WindowState = xlMinimized
Dim I As Integer
For I = 1 To Sheets.Count
Sheets(I).Select
ActiveWindow.Zoom = True
ActiveWindow.Zoom = 128
Next
ActiveWindow.WindowState = xlMaximized
End Sub

Many thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default How do I stop Macro from affect other Workbooks

I discovered the following additions that use the value of the current
workbook name which works even better:

Sub Big()
Dim strCurrent As String
strCurrent = ActiveWindow.Caption
Application.Windows(strCurrent).WindowState = xlMinimized
Dim I As Integer
For I = 1 To ActiveWorkbook.Sheets.Count
Sheets(I).Select
Application.Windows(strCurrent).Zoom = True
Application.Windows(strCurrent).Zoom = 128
Next
End Sub

Thanks for your help

"B Baggins" wrote:

I am trying to create a 'simple' macro in Excel2003 that will Zoom everysheet
to 128% (to allow for different user screen resolutions). I have a macro
that works but it also does any other (non-minimised) spreadsheet that is
open.

Can anyone tell me what I need to add to restrict it to the current
workbook. (NB the user is free to rename the workbook so I can not hard
program the file name in).

Sub Big()
ActiveWindow.WindowState = xlMinimized
Dim I As Integer
For I = 1 To Sheets.Count
Sheets(I).Select
ActiveWindow.Zoom = True
ActiveWindow.Zoom = 128
Next
ActiveWindow.WindowState = xlMaximized
End Sub

Many thanks

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
Macro to affect all sheets REMB Excel Discussion (Misc queries) 3 June 4th 10 09:03 PM
i need to stop 2 workbooks being linked-how do i do this kkirstyy Excel Discussion (Misc queries) 1 August 24th 06 02:53 PM
How can I Run a query from VB macro with out affect current data in the same sheet? oafdl Excel Discussion (Misc queries) 0 May 29th 06 09:42 PM
Add-In - OnAction Can't Find Macro & Subs Doesn't Affect Current Wkb [email protected] Excel Programming 6 August 13th 05 12:11 AM
Menu customizations affect all workbooks? [email protected] Excel Programming 3 June 7th 05 03:58 AM


All times are GMT +1. The time now is 02:19 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"