PC Review


Reply
Thread Tools Rate Thread

Code Works for Some Worksheets, But Not Others

 
 
=?Utf-8?B?RGV2RGFuaWVs?=
Guest
Posts: n/a
 
      21st Feb 2007
I have a macro which moves to each worksheet and changes the page setup
properties. The code changes the properties on some worksheets, but not
others.

Have anyone had a similar problem? Is the file corrupt? I have tried
- selecting all worksheets and changing the properties
- looping through each worksheet and changing the properties
Neither worked.

Code snippet:

Dim ws As Worksheet

For Each ws In Worksheets

If ws.Name = "Main" Then

With ws.PageSetup
.PrintQuality = 600
.FitToPagesWide = 1
.FitToPagesTall = False
End With

Else

With ws.PageSetup
.PrintQuality = 600
End With

End If

Next ws

 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      21st Feb 2007

You may have meant to say
If ws.Name <> "Main" Then

--
Don Guillett
SalesAid Software
(E-Mail Removed)
"DevDaniel" <(E-Mail Removed)> wrote in message
news:EFE6D924-4C72-4426-A96E-(E-Mail Removed)...
>I have a macro which moves to each worksheet and changes the page setup
> properties. The code changes the properties on some worksheets, but not
> others.
>
> Have anyone had a similar problem? Is the file corrupt? I have tried
> - selecting all worksheets and changing the properties
> - looping through each worksheet and changing the properties
> Neither worked.
>
> Code snippet:
>
> Dim ws As Worksheet
>
> For Each ws In Worksheets
>
> If ws.Name = "Main" Then
>
> With ws.PageSetup
> .PrintQuality = 600
> .FitToPagesWide = 1
> .FitToPagesTall = False
> End With
>
> Else
>
> With ws.PageSetup
> .PrintQuality = 600
> End With
>
> End If
>
> Next ws
>



 
Reply With Quote
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      21st Feb 2007
the code worked fine for me.

have you tried manually changing that setting on the recalcitrant sheets?

--
Regards,
Tom Ogilvy


"DevDaniel" wrote:

> I have a macro which moves to each worksheet and changes the page setup
> properties. The code changes the properties on some worksheets, but not
> others.
>
> Have anyone had a similar problem? Is the file corrupt? I have tried
> - selecting all worksheets and changing the properties
> - looping through each worksheet and changing the properties
> Neither worked.
>
> Code snippet:
>
> Dim ws As Worksheet
>
> For Each ws In Worksheets
>
> If ws.Name = "Main" Then
>
> With ws.PageSetup
> .PrintQuality = 600
> .FitToPagesWide = 1
> .FitToPagesTall = False
> End With
>
> Else
>
> With ws.PageSetup
> .PrintQuality = 600
> End With
>
> End If
>
> Next ws
>

 
Reply With Quote
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      21st Feb 2007
Also, if it is only the main sheet that is problematic, recall the Vergel
showed to set the zoom as well

With ws.PageSetup
.PrintQuality = 600
.Zoom = False '< == added line
.FitToPagesWide = 1
.FitToPagesTall = False
End With


The zoom property can override Fit to print so you should set it explicitly
to false.

--
Regards,
Tom Ogilvy


"DevDaniel" wrote:

> I have a macro which moves to each worksheet and changes the page setup
> properties. The code changes the properties on some worksheets, but not
> others.
>
> Have anyone had a similar problem? Is the file corrupt? I have tried
> - selecting all worksheets and changing the properties
> - looping through each worksheet and changing the properties
> Neither worked.
>
> Code snippet:
>
> Dim ws As Worksheet
>
> For Each ws In Worksheets
>
> If ws.Name = "Main" Then
>
> With ws.PageSetup
> .PrintQuality = 600
> .FitToPagesWide = 1
> .FitToPagesTall = False
> End With
>
> Else
>
> With ws.PageSetup
> .PrintQuality = 600
> End With
>
> End If
>
> Next ws
>

 
Reply With Quote
 
=?Utf-8?B?RGV2RGFuaWVs?=
Guest
Posts: n/a
 
      21st Feb 2007
Hi Tom,

I've tried with and without the zoom, but no luck.

The worksheets that are causing the problem have a blank print quality (they
are inserted by another process). I was using macro to change iprint quality
to 600 dpi, but it is not working.

"Tom Ogilvy" wrote:

> Also, if it is only the main sheet that is problematic, recall the Vergel
> showed to set the zoom as well
>
> With ws.PageSetup
> .PrintQuality = 600
> .Zoom = False '< == added line
> .FitToPagesWide = 1
> .FitToPagesTall = False
> End With
>
>
> The zoom property can override Fit to print so you should set it explicitly
> to false.
>
> --
> Regards,
> Tom Ogilvy
>
>
> "DevDaniel" wrote:
>
> > I have a macro which moves to each worksheet and changes the page setup
> > properties. The code changes the properties on some worksheets, but not
> > others.
> >
> > Have anyone had a similar problem? Is the file corrupt? I have tried
> > - selecting all worksheets and changing the properties
> > - looping through each worksheet and changing the properties
> > Neither worked.
> >
> > Code snippet:
> >
> > Dim ws As Worksheet
> >
> > For Each ws In Worksheets
> >
> > If ws.Name = "Main" Then
> >
> > With ws.PageSetup
> > .PrintQuality = 600
> > .FitToPagesWide = 1
> > .FitToPagesTall = False
> > End With
> >
> > Else
> >
> > With ws.PageSetup
> > .PrintQuality = 600
> > End With
> >
> > End If
> >
> > Next ws
> >

 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      21st Feb 2007
I have no idea if this will work or not but I just went to mine and I have
no option (xerox 6200b color laser) shown BUT 600 dpi. So, maybe change
printer driver (if you don't have others installed try anything)>do a print
preview on any sheet> change printer back to your original and see what you
have on the imported sheets.???????

--
Don Guillett
SalesAid Software
(E-Mail Removed)
"DevDaniel" <(E-Mail Removed)> wrote in message
news:018010D5-5814-430D-959B-(E-Mail Removed)...
> Hi Tom,
>
> I've tried with and without the zoom, but no luck.
>
> The worksheets that are causing the problem have a blank print quality
> (they
> are inserted by another process). I was using macro to change iprint
> quality
> to 600 dpi, but it is not working.
>
> "Tom Ogilvy" wrote:
>
>> Also, if it is only the main sheet that is problematic, recall the Vergel
>> showed to set the zoom as well
>>
>> With ws.PageSetup
>> .PrintQuality = 600
>> .Zoom = False '< == added line
>> .FitToPagesWide = 1
>> .FitToPagesTall = False
>> End With
>>
>>
>> The zoom property can override Fit to print so you should set it
>> explicitly
>> to false.
>>
>> --
>> Regards,
>> Tom Ogilvy
>>
>>
>> "DevDaniel" wrote:
>>
>> > I have a macro which moves to each worksheet and changes the page setup
>> > properties. The code changes the properties on some worksheets, but not
>> > others.
>> >
>> > Have anyone had a similar problem? Is the file corrupt? I have tried
>> > - selecting all worksheets and changing the properties
>> > - looping through each worksheet and changing the properties
>> > Neither worked.
>> >
>> > Code snippet:
>> >
>> > Dim ws As Worksheet
>> >
>> > For Each ws In Worksheets
>> >
>> > If ws.Name = "Main" Then
>> >
>> > With ws.PageSetup
>> > .PrintQuality = 600
>> > .FitToPagesWide = 1
>> > .FitToPagesTall = False
>> > End With
>> >
>> > Else
>> >
>> > With ws.PageSetup
>> > .PrintQuality = 600
>> > End With
>> >
>> > End If
>> >
>> > Next ws
>> >



 
Reply With Quote
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      21st Feb 2007
Like I said, it works for me. Does the print out look any different. As far
as I know, this is pretty much a dead setting, but I guess it would depend on
the printer.

--
Regards,
Tom Ogilvy


"DevDaniel" wrote:

> Hi Tom,
>
> I've tried with and without the zoom, but no luck.
>
> The worksheets that are causing the problem have a blank print quality (they
> are inserted by another process). I was using macro to change iprint quality
> to 600 dpi, but it is not working.
>
> "Tom Ogilvy" wrote:
>
> > Also, if it is only the main sheet that is problematic, recall the Vergel
> > showed to set the zoom as well
> >
> > With ws.PageSetup
> > .PrintQuality = 600
> > .Zoom = False '< == added line
> > .FitToPagesWide = 1
> > .FitToPagesTall = False
> > End With
> >
> >
> > The zoom property can override Fit to print so you should set it explicitly
> > to false.
> >
> > --
> > Regards,
> > Tom Ogilvy
> >
> >
> > "DevDaniel" wrote:
> >
> > > I have a macro which moves to each worksheet and changes the page setup
> > > properties. The code changes the properties on some worksheets, but not
> > > others.
> > >
> > > Have anyone had a similar problem? Is the file corrupt? I have tried
> > > - selecting all worksheets and changing the properties
> > > - looping through each worksheet and changing the properties
> > > Neither worked.
> > >
> > > Code snippet:
> > >
> > > Dim ws As Worksheet
> > >
> > > For Each ws In Worksheets
> > >
> > > If ws.Name = "Main" Then
> > >
> > > With ws.PageSetup
> > > .PrintQuality = 600
> > > .FitToPagesWide = 1
> > > .FitToPagesTall = False
> > > End With
> > >
> > > Else
> > >
> > > With ws.PageSetup
> > > .PrintQuality = 600
> > > End With
> > >
> > > End If
> > >
> > > Next ws
> > >

 
Reply With Quote
 
=?Utf-8?B?RGV2RGFuaWVs?=
Guest
Posts: n/a
 
      23rd Feb 2007
Thanks for your time and suggestions, guys. The issue appears to be
workstation-related, because the macro runs fine on other PCs in the office.

"DevDaniel" wrote:

> Hi Tom,
>
> I've tried with and without the zoom, but no luck.
>
> The worksheets that are causing the problem have a blank print quality (they
> are inserted by another process). I was using macro to change iprint quality
> to 600 dpi, but it is not working.
>
> "Tom Ogilvy" wrote:
>
> > Also, if it is only the main sheet that is problematic, recall the Vergel
> > showed to set the zoom as well
> >
> > With ws.PageSetup
> > .PrintQuality = 600
> > .Zoom = False '< == added line
> > .FitToPagesWide = 1
> > .FitToPagesTall = False
> > End With
> >
> >
> > The zoom property can override Fit to print so you should set it explicitly
> > to false.
> >
> > --
> > Regards,
> > Tom Ogilvy
> >
> >
> > "DevDaniel" wrote:
> >
> > > I have a macro which moves to each worksheet and changes the page setup
> > > properties. The code changes the properties on some worksheets, but not
> > > others.
> > >
> > > Have anyone had a similar problem? Is the file corrupt? I have tried
> > > - selecting all worksheets and changing the properties
> > > - looping through each worksheet and changing the properties
> > > Neither worked.
> > >
> > > Code snippet:
> > >
> > > Dim ws As Worksheet
> > >
> > > For Each ws In Worksheets
> > >
> > > If ws.Name = "Main" Then
> > >
> > > With ws.PageSetup
> > > .PrintQuality = 600
> > > .FitToPagesWide = 1
> > > .FitToPagesTall = False
> > > End With
> > >
> > > Else
> > >
> > > With ws.PageSetup
> > > .PrintQuality = 600
> > > End With
> > >
> > > End If
> > >
> > > Next ws
> > >

 
Reply With Quote
 
=?Utf-8?B?RGV2RGFuaWVs?=
Guest
Posts: n/a
 
      28th Mar 2007
I re-imaged my PC (reinstalling Excel 2003 and Acrobat 7.0). The code works
fine now.


"DevDaniel" wrote:

> Hi Tom,
>
> I've tried with and without the zoom, but no luck.
>
> The worksheets that are causing the problem have a blank print quality (they
> are inserted by another process). I was using macro to change iprint quality
> to 600 dpi, but it is not working.
>
> "Tom Ogilvy" wrote:
>
> > Also, if it is only the main sheet that is problematic, recall the Vergel
> > showed to set the zoom as well
> >
> > With ws.PageSetup
> > .PrintQuality = 600
> > .Zoom = False '< == added line
> > .FitToPagesWide = 1
> > .FitToPagesTall = False
> > End With
> >
> >
> > The zoom property can override Fit to print so you should set it explicitly
> > to false.
> >
> > --
> > Regards,
> > Tom Ogilvy
> >
> >
> > "DevDaniel" wrote:
> >
> > > I have a macro which moves to each worksheet and changes the page setup
> > > properties. The code changes the properties on some worksheets, but not
> > > others.
> > >
> > > Have anyone had a similar problem? Is the file corrupt? I have tried
> > > - selecting all worksheets and changing the properties
> > > - looping through each worksheet and changing the properties
> > > Neither worked.
> > >
> > > Code snippet:
> > >
> > > Dim ws As Worksheet
> > >
> > > For Each ws In Worksheets
> > >
> > > If ws.Name = "Main" Then
> > >
> > > With ws.PageSetup
> > > .PrintQuality = 600
> > > .FitToPagesWide = 1
> > > .FitToPagesTall = False
> > > End With
> > >
> > > Else
> > >
> > > With ws.PageSetup
> > > .PrintQuality = 600
> > > End With
> > >
> > > End If
> > >
> > > Next ws
> > >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula works on all worksheets except for 2 Jan Microsoft Excel Worksheet Functions 3 30th Mar 2009 05:36 PM
can excel add worksheets based on cell population in another works new user Microsoft Excel Worksheet Functions 3 16th Mar 2009 01:54 PM
Macros: Establishing new worksheets, calculations in various works =?Utf-8?B?S2VuIFJvYmVydHM=?= Microsoft Access Macros 1 30th Jun 2007 09:00 PM
Re: Code works in one MDB, but corrupts. Code doesn't work in a new M John Nurick Microsoft Access VBA Modules 1 22nd Aug 2004 01:13 AM
Need code to protect worksheets - amount of worksheets varies Sandy Microsoft Excel Programming 1 9th Sep 2003 02:17 AM


Features
 

Advertising
 

Newsgroups
 


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