Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default margins do not fit page size error

hi there,

I have aVB.net app that create a excel workseet on the fly. and i want to
set up all margins to 0.
I tried the following and got an error message saying "margins do not fit
page size". i was able to do almost anything like setting a font for a cell
and so forth ... but no this.

'
' of course i have declare objects on top
'
objSheet.PageSetup.FooterMargin = objApp.InchesToPoints(0)
objSheet.PageSetup.BottomMargin = objApp.InchesToPoints(0)
objSheet.PageSetup.TopMargin = objApp.InchesToPoints(0)
objSheet.PageSetup.BottomMargin = objApp.InchesToPoints(0)
objSheet.PageSetup.LeftMargin = objApp.InchesToPoints(0)
objSheet.PageSetup.RightMargin = objApp.InchesToPoints(0)

I have zebra barcode label printer as a default printer and set 1.25" X
1.00" as a default paper size.
please help me.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default margins do not fit page size error

some printerdrivers just wont accept 0 margins.
(you could try fiddling around in the printer
driver's install.. PPD files...)

however to minimize margins try like following:

in vba (not NET) this works...

Sub minMargins()
On Error Resume Next
With ActiveSheet.PageSetup
Debug.Print .TopMargin, .BottomMargin, .LeftMargin, .RightMargin
.TopMargin = 0
.BottomMargin = 0
.LeftMargin = 0
.TopMargin = 0
Debug.Print .TopMargin, .BottomMargin, .LeftMargin, .RightMargin
.TopMargin = .BottomMargin / 2
.BottomMargin = .TopMargin
.LeftMargin = .RightMargin / 2
.RightMargin = .LeftMargin
Debug.Print .TopMargin, .BottomMargin, .LeftMargin, .RightMargin
End With
End Sub


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Mike Kim" wrote:

hi there,

I have aVB.net app that create a excel workseet on the fly. and i want
to set up all margins to 0.
I tried the following and got an error message saying "margins do not
fit page size". i was able to do almost anything like setting a font
for a cell and so forth ... but no this.

'
' of course i have declare objects on top
'
objSheet.PageSetup.FooterMargin = objApp.InchesToPoints(0)
objSheet.PageSetup.BottomMargin = objApp.InchesToPoints(0)
objSheet.PageSetup.TopMargin = objApp.InchesToPoints(0)
objSheet.PageSetup.BottomMargin = objApp.InchesToPoints(0)
objSheet.PageSetup.LeftMargin = objApp.InchesToPoints(0)
objSheet.PageSetup.RightMargin = objApp.InchesToPoints(0)

I have zebra barcode label printer as a default printer and set 1.25"
X 1.00" as a default paper size.
please help me.



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
Error message "Margins do not fit page size" in Excel? lester5 Excel Discussion (Misc queries) 4 December 12th 12 10:28 PM
error message - "margins do not fit page size" Dave Eade Excel Discussion (Misc queries) 1 October 28th 09 01:23 PM
how do i fix error message 'margins do not fit page size' LC Excel Discussion (Misc queries) 0 July 20th 07 04:42 PM
Margins do not fit page size! law Excel Discussion (Misc queries) 1 September 13th 06 02:20 PM
"Margins do not fit page size" error, but I'm not printing! bubbles1611 Excel Discussion (Misc queries) 0 September 21st 05 03:41 AM


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