Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Changing footer programmatically in multiple sheets all at once

Because of the slow execution of .PageSetup property with specific printers,
especially when done on multiple sheets, because of cumulative time, I would
like to programmatically cahnge that property all at once on all sheets.
As that operation is possible manually if multiple sheets are selected, I
tried to register the macro and it gave following lines:

Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet1 (2)", "Sheet2 (2)")).Select
Sheets("Sheet1").Activate
With ActiveSheet.PageSetup
.LeftFooter = "&12Test 3ème test" & Chr(10) & "C O N F I D E N T I A
L"
End With

Unfortunately, when replayed, the macro only modify the first sheet of the
array.

how to do that programmatically ?

Thanks in advance for your help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Changing footer programmatically in multiple sheets all at once

Alan,

macrocommands "old style" to the rescue:
(get a copy of macrofun.hlp from microsoft if you need a reference)

xl4 macro's are LOTS faster for setting multiple print settings.
john green posted a very usefull function too:
http://google.com/groups?selm=VA.000...28c7e5%40mara9


Worksheets.Select
Application.ExecuteExcel4Macro
("PAGE.SETUP(,""&lTextLeft&cTextCenter&rTextright" ")")
ActiveSheet.Select True

or
Dim s$
s = "&L&12Test 3ème test" & vbLf & "C O N F I D E N T I A L"
Worksheets.Select
Application.ExecuteExcel4Macro _
Replace("PAGE.SETUP(,""|foot|"")", "|foot|", s)
ActiveSheet.Select True
End Sub



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


alan674 wrote :

Because of the slow execution of .PageSetup property with specific
printers, especially when done on multiple sheets, because of
cumulative time, I would like to programmatically cahnge that
property all at once on all sheets. As that operation is possible
manually if multiple sheets are selected, I tried to register the
macro and it gave following lines:

Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet1 (2)", "Sheet2
(2)")).Select Sheets("Sheet1").Activate
With ActiveSheet.PageSetup
.LeftFooter = "&12Test 3ème test" & Chr(10) & "C O N F I D E
N T I A L"
End With

Unfortunately, when replayed, the macro only modify the first sheet
of the array.

how to do that programmatically ?

Thanks in advance for your help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Changing footer programmatically in multiple sheets all at once


"alan674" schrieb im Newsbeitrag
...
Because of the slow execution of .PageSetup property with specific
printers,
especially when done on multiple sheets, because of cumulative time, I
would
like to programmatically cahnge that property all at once on all sheets.
As that operation is possible manually if multiple sheets are selected, I
tried to register the macro and it gave following lines:

Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet1 (2)", "Sheet2
(2)")).Select
Sheets("Sheet1").Activate
With ActiveSheet.PageSetup
.LeftFooter = "&12Test 3ème test" & Chr(10) & "C O N F I D E N T I
A
L"
End With

Unfortunately, when replayed, the macro only modify the first sheet of the
array.

how to do that programmatically ?

Thanks in advance for your help


Hi Alan(?)

you need a loop to access all members of the Worksheets collection

for each mySheet in Worksheets
mySheet.leftfooter = "Whatever..."
next

cheers,
Stephan


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
Copy custom footer across multiple sheets Clark Excel Worksheet Functions 3 August 6th 08 03:59 PM
Using same Header & Footer for Multiple Sheets in Excel Master Yoda Excel Discussion (Misc queries) 3 May 30th 05 11:22 PM
Header or Footer to show up on multiple sheets in a document Holly Domine Excel Worksheet Functions 1 May 23rd 05 06:17 PM
how do i change footer settings on multiple sheets at the same ti. Chris Excel Worksheet Functions 1 March 29th 05 03:05 PM
Changing the value in multiple sheets without selecting those sheets herm Excel Programming 3 October 14th 03 03:50 PM


All times are GMT +1. The time now is 02:41 PM.

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

About Us

"It's about Microsoft Excel"