Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
al al is offline
external usenet poster
 
Posts: 64
Default Print area - Message box

Can someone correct macro below pls - why is my "false" input not
working - thxs


Sub Printseuplandscape()
'
'
Dim Fitp
Application.ScreenUpdating = False
'
ActiveSheet.Pagesetup.PrintArea = ActiveRange
With ActiveSheet.Pagesetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.Pagesetup.PrintArea = Selection.Address
With ActiveSheet.Pagesetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = "&D-&T"
.CenterFooter = "&P of &N"
.RightFooter = "&Z&F-&F-&A"
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default Print area - Message box

It looks like your trying to use a string where a boolean value is
required.

Sub Printseuplandscape()
'
'
Dim Fitpg
Application.ScreenUpdating = False
'
'ActiveSheet.PageSetup.PrintArea = ActiveRange
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = Selection.Address
With ActiveSheet.PageSetup
' .LeftHeader = ""
' .CenterHeader = ""
' .RightHeader = ""
.LeftFooter = "&D-&T"
.CenterFooter = "&P of &N"
.RightFooter = "&Z&F-&F-&A"
.FitToPagesWide = 1


Fitpg = Application.InputBox _
(Prompt:="To fit to 1 page type 1, otherwise click cancel",
Default:="", Title:="Fit to page tall", Type:=1)


.FitToPagesTall = Fitpg
' .PrintErrors = xlPrintErrorsDisplayed
End With
Application.ScreenUpdating = True
End Sub

Keep an eye on your spelling also.

Cliff Edwards
  #3   Report Post  
Posted to microsoft.public.excel.programming
al al is offline
external usenet poster
 
Posts: 64
Default Print area - Message box

On Jan 15, 2:51 am, ward376 wrote:
It looks like your trying to use a string where a boolean value is
required.

Sub Printseuplandscape()
'
'
Dim Fitpg
Application.ScreenUpdating = False
'
'ActiveSheet.PageSetup.PrintArea = ActiveRange
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = Selection.Address
With ActiveSheet.PageSetup
' .LeftHeader = ""
' .CenterHeader = ""
' .RightHeader = ""
.LeftFooter = "&D-&T"
.CenterFooter = "&P of &N"
.RightFooter = "&Z&F-&F-&A"
.FitToPagesWide = 1

Fitpg = Application.InputBox _
(Prompt:="To fit to 1 page type 1, otherwise click cancel",
Default:="", Title:="Fit to page tall", Type:=1)

.FitToPagesTall = Fitpg
' .PrintErrors = xlPrintErrorsDisplayed
End With
Application.ScreenUpdating = True
End Sub

Keep an eye on your spelling also.

Cliff Edwards


i know its wrong but What correction do i need to make for it to work??
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Print area - Message box

On Jan 14, 11:00*pm, al wrote:
On Jan 15, 2:51 am, ward376 wrote:



It looks like your trying to use a string where a boolean value is
required.


Sub Printseuplandscape()
'
'
Dim Fitpg
Application.ScreenUpdating = False
'
* * 'ActiveSheet.PageSetup.PrintArea = ActiveRange
* * With ActiveSheet.PageSetup
* * * * .PrintTitleRows = ""
* * * * .PrintTitleColumns = ""
* * End With
* * ActiveSheet.PageSetup.PrintArea = Selection.Address
* * With ActiveSheet.PageSetup
' * * * *.LeftHeader = ""
' * * * *.CenterHeader = ""
' * * * *.RightHeader = ""
* * * * .LeftFooter = "&D-&T"
* * * * .CenterFooter = "&P of &N"
* * * * .RightFooter = "&Z&F-&F-&A"
* * * * .FitToPagesWide = 1


* * * * Fitpg = Application.InputBox _
* * (Prompt:="To fit to 1 page type 1, otherwise click cancel",
Default:="", Title:="Fit to page tall", Type:=1)


* * * * .FitToPagesTall = Fitpg
' * * * *.PrintErrors = xlPrintErrorsDisplayed
* * End With
* * Application.ScreenUpdating = True
End Sub


Keep an eye on your spelling also.


Cliff Edwards


i know its wrong but What correction do i need to make for it to work??


Try entering False as a Boolean, that is, don't put the quotes around
it.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Print area - Message box

Or as ward376 indicated, just set the Default as "", rather than the
"False" you had entered.



On Jan 14, 11:00*pm, al wrote:
On Jan 15, 2:51 am, ward376 wrote:



It looks like your trying to use a string where a boolean value is
required.


Sub Printseuplandscape()
'
'
Dim Fitpg
Application.ScreenUpdating = False
'
* * 'ActiveSheet.PageSetup.PrintArea = ActiveRange
* * With ActiveSheet.PageSetup
* * * * .PrintTitleRows = ""
* * * * .PrintTitleColumns = ""
* * End With
* * ActiveSheet.PageSetup.PrintArea = Selection.Address
* * With ActiveSheet.PageSetup
' * * * *.LeftHeader = ""
' * * * *.CenterHeader = ""
' * * * *.RightHeader = ""
* * * * .LeftFooter = "&D-&T"
* * * * .CenterFooter = "&P of &N"
* * * * .RightFooter = "&Z&F-&F-&A"
* * * * .FitToPagesWide = 1


* * * * Fitpg = Application.InputBox _
* * (Prompt:="To fit to 1 page type 1, otherwise click cancel",
Default:="", Title:="Fit to page tall", Type:=1)


* * * * .FitToPagesTall = Fitpg
' * * * *.PrintErrors = xlPrintErrorsDisplayed
* * End With
* * Application.ScreenUpdating = True
End Sub


Keep an eye on your spelling also.


Cliff Edwards


i know its wrong but What correction do i need to make for it to work??




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Print area - Message box

as user only has two choices (yes or no) try using a message box.

Sub Printseuplandscape()

Dim Fitp As Variant
Application.ScreenUpdating = False

With ActiveSheet

.PageSetup.PrintArea = ActiveRange

With .PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With

.PageSetup.PrintArea = Selection.Address

With .PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = "&D-&T"
.CenterFooter = "&P of &N"
.RightFooter = "&Z&F-&F-&A"
.FitToPagesWide = 1

msg = MsgBox("Do you want to Fit to one page?", 36, "Page setUp")

If msg = 6 Then
fitpg = 1
Else
fitpg = False
End If

.FitToPagesTall = fitpg
.PrintErrors = xlPrintErrorsDisplayed

End With

End With
Application.ScreenUpdating = True
End Sub

--
jb


"al" wrote:

Can someone correct macro below pls - why is my "false" input not
working - thxs


Sub Printseuplandscape()
'
'
Dim Fitp
Application.ScreenUpdating = False
'
ActiveSheet.Pagesetup.PrintArea = ActiveRange
With ActiveSheet.Pagesetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.Pagesetup.PrintArea = Selection.Address
With ActiveSheet.Pagesetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = "&D-&T"
.CenterFooter = "&P of &N"
.RightFooter = "&Z&F-&F-&A"
.
.FitToPagesWide = 1


Fitpg = Application.InputBox _
(Prompt:="To fit to 1 page type 1.", Default:="False", Title:="Fit
to page tall", Type:=1)


.FitToPagesTall = Fitpg
.PrintErrors = xlPrintErrorsDisplayed
End With
Application.ScreenUpdating = True
End Sub

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
set area in excel not giving me option to set print area? J Littlebear Excel Discussion (Misc queries) 4 April 23rd 23 09:04 PM
File, print area, clear area, is not working cblind New Users to Excel 2 September 12th 07 04:51 PM
print area across the freeze panes area tom Excel Worksheet Functions 2 January 6th 07 05:23 PM
Macro - Set Print Area for Changing Data Area ksp Excel Programming 5 May 15th 06 10:20 PM
How do you turn off a print area for a page? (no print area) Grunen Excel Discussion (Misc queries) 4 October 8th 05 07:46 PM


All times are GMT +1. The time now is 01:06 AM.

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"