Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default pagesetup object

I believe that I should be able to "pass" the parameter settings of one
pagesetup on a worksheet to another and thus having the same headers,
footers, margins, print areas and such without having to declare each
setting....

private sub setupworksheetprintarea()

dim w as worksheet
dim wkb as workbook
dim pg as pagesetup

set w = thisworkbook.activesheet

set wkb = workbooks.add


set wkb.activesheet.pagesetup = w.pagesetup


end sub


I am only speculating but I think it should work...





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default pagesetup object

It sure would be nice if it did. But I betting it didn't work when you tried
it, huh?

Steven Cheng wrote:

I believe that I should be able to "pass" the parameter settings of one
pagesetup on a worksheet to another and thus having the same headers,
footers, margins, print areas and such without having to declare each
setting....

private sub setupworksheetprintarea()

dim w as worksheet
dim wkb as workbook
dim pg as pagesetup

set w = thisworkbook.activesheet

set wkb = workbooks.add

set wkb.activesheet.pagesetup = w.pagesetup

end sub

I am only speculating but I think it should work...


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default pagesetup object

nope...not a chance...ugh....

"Dave Peterson" wrote:

It sure would be nice if it did. But I betting it didn't work when you tried
it, huh?

Steven Cheng wrote:

I believe that I should be able to "pass" the parameter settings of one
pagesetup on a worksheet to another and thus having the same headers,
footers, margins, print areas and such without having to declare each
setting....

private sub setupworksheetprintarea()

dim w as worksheet
dim wkb as workbook
dim pg as pagesetup

set w = thisworkbook.activesheet

set wkb = workbooks.add

set wkb.activesheet.pagesetup = w.pagesetup

end sub

I am only speculating but I think it should work...


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default pagesetup object

Steven,
As Dave says, it won't work.
See the help for the PageSetUp property:
<Help
Returns a PageSetup object that contains all the page setup settings for the
specified object. Read-only.
</Help
Note the Read-Only. so:

Private Sub CommandButton2_Click()
Dim PSetUp As PageSetup
'This works
Set PSetUp = ThisWorkbook.Worksheets(1).PageSetup
'This fails
Set ThisWorkbook.Worksheets(2).PageSetup = PSetUp

End Sub

NickHK

"Steven Cheng" wrote in message
...
I believe that I should be able to "pass" the parameter settings of one
pagesetup on a worksheet to another and thus having the same headers,
footers, margins, print areas and such without having to declare each
setting....

private sub setupworksheetprintarea()

dim w as worksheet
dim wkb as workbook
dim pg as pagesetup

set w = thisworkbook.activesheet

set wkb = workbooks.add


set wkb.activesheet.pagesetup = w.pagesetup


end sub


I am only speculating but I think it should work...







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default pagesetup object

There are a lot of settings that get transfered when you select multiple sheets
(have to be in the same workbook, though), then go into file|page setup and
click ok.

And the page setup stuff can really slow down your macro. Keep just the
settings you want to change.

Tom Ogilvy combined some tips from John Green and keepitcool in this post:

http://groups.google.co.uk/group/mic...9 b26c2cb850e

or
http://snipurl.com/1cfe3



Steven Cheng wrote:

nope...not a chance...ugh....

"Dave Peterson" wrote:

It sure would be nice if it did. But I betting it didn't work when you tried
it, huh?

Steven Cheng wrote:

I believe that I should be able to "pass" the parameter settings of one
pagesetup on a worksheet to another and thus having the same headers,
footers, margins, print areas and such without having to declare each
setting....

private sub setupworksheetprintarea()

dim w as worksheet
dim wkb as workbook
dim pg as pagesetup

set w = thisworkbook.activesheet

set wkb = workbooks.add

set wkb.activesheet.pagesetup = w.pagesetup

end sub

I am only speculating but I think it should work...


--

Dave Peterson


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default pagesetup object

The code that Tom included from John Green uses xl4 macros and can be much
faster.

Dave Peterson wrote:

There are a lot of settings that get transfered when you select multiple sheets
(have to be in the same workbook, though), then go into file|page setup and
click ok.

And the page setup stuff can really slow down your macro. Keep just the
settings you want to change.

Tom Ogilvy combined some tips from John Green and keepitcool in this post:

http://groups.google.co.uk/group/mic...9 b26c2cb850e

or
http://snipurl.com/1cfe3

Steven Cheng wrote:

nope...not a chance...ugh....

"Dave Peterson" wrote:

It sure would be nice if it did. But I betting it didn't work when you tried
it, huh?

Steven Cheng wrote:

I believe that I should be able to "pass" the parameter settings of one
pagesetup on a worksheet to another and thus having the same headers,
footers, margins, print areas and such without having to declare each
setting....

private sub setupworksheetprintarea()

dim w as worksheet
dim wkb as workbook
dim pg as pagesetup

set w = thisworkbook.activesheet

set wkb = workbooks.add

set wkb.activesheet.pagesetup = w.pagesetup

end sub

I am only speculating but I think it should work...

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default pagesetup object

thanks Dave. this little tidbit is pretty good.

"Dave Peterson" wrote:

The code that Tom included from John Green uses xl4 macros and can be much
faster.

Dave Peterson wrote:

There are a lot of settings that get transfered when you select multiple sheets
(have to be in the same workbook, though), then go into file|page setup and
click ok.

And the page setup stuff can really slow down your macro. Keep just the
settings you want to change.

Tom Ogilvy combined some tips from John Green and keepitcool in this post:

http://groups.google.co.uk/group/mic...9 b26c2cb850e

or
http://snipurl.com/1cfe3

Steven Cheng wrote:

nope...not a chance...ugh....

"Dave Peterson" wrote:

It sure would be nice if it did. But I betting it didn't work when you tried
it, huh?

Steven Cheng wrote:

I believe that I should be able to "pass" the parameter settings of one
pagesetup on a worksheet to another and thus having the same headers,
footers, margins, print areas and such without having to declare each
setting....

private sub setupworksheetprintarea()

dim w as worksheet
dim wkb as workbook
dim pg as pagesetup

set w = thisworkbook.activesheet

set wkb = workbooks.add

set wkb.activesheet.pagesetup = w.pagesetup

end sub

I am only speculating but I think it should work...

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson

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
PageSetup Class P Dev Excel Programming 9 August 19th 08 02:39 AM
Activesheet.pagesetup Spenceley Excel Programming 2 August 3rd 06 03:21 PM
PageSetup Stanley Excel Discussion (Misc queries) 1 December 14th 05 07:21 PM
PageSetup Simon Shaw Excel Programming 3 May 28th 05 01:28 PM
PageSetup Simon Shaw[_4_] Excel Programming 1 May 28th 04 08:41 AM


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

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"