LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Excel hanging up?

Good show, Otto! Makes one feel good when those bugs are exterminated.

"Otto Moehrbach" wrote:

Jim & JLGWhiz
Thanks to both of you for your help. From what both of you said, I
cranked the brain and went through many code scenarios to nail down the one
thing that was causing my problem. I think I came up with it.
It appears that there is an incompatibility between having pagebreaks
displayed and running any code that hides/unhides rows/columns. Jim, I took
your line:
ActiveSheet.DisplayPageBreaks = False
and placed it before the hide/unhide code as well as before the code in the
print macro that accessed PageSetup and the problem was solved.
Thanks again, both of you. Otto
"Jim Cone" wrote in message
...
Otto,
Two things to try...
Set DisplayPageBreaks = False before calling PageSetUp
Set the .Zoom setting to 100 before changing any other PageSetUp
properties.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Otto Moehrbach"
wrote in message
Excel XP, Win XP
Please read this entire message. It flows easily. I promise!
I'm helping an OP and I have a problem I can't figure out.
I have only one file with only one sheet.
I wrote 2 completely interdependent procedures.
Procedure #1 hides rows and columns as a function of a selection made by
clicking on one of several buttons in a UserForm. Works fine and takes
about 1 second.
Procedure #2 is a print procedure. A Workbook_BeforePrint macro cancels
the
print command and calls Procedure #2. Procedure #2 sets the print range
and
determines the number of columns to be printed (the visible columns) and
prints. This works fine also if ( a BIG IF) I leave it at that. (Code
takes
about 0.5 seconds to run, then prints)

But I have additional code in Procedure #2 to set Portrait or Landscape as
a
function of the number of columns to be printed. Let's call that
additional
code Portrait/Landscape. And therein lays the problem. With that
Portrait/Landscape code in place, if I run Procedure #2, Procedure #2
takes
a very long time to run. But worse than that, after that, Procedure #1
takes a very, very, long time to run. Remember that the 2 procedures are
completely independent. It seems like Excel is getting into some state
(almost hung-up) if the Portrait/Landscape code runs. If I close the file
and open the file, everything is fine with Procedure #1 until I again run
Procedure #2. I have also cleaned the project with Rob Bovey's Code
Cleaner.

I have written the Portrait/Landscape code as:

If ColCount ColPerPage Then
Call SetPortrait
Else
Call SetLandscape
End If

The SetPortrait macro I have written as:

With ActiveSheet.PageSetup
.Orientation = xlLandscape
.FitToPagesWide = 1
.FitToPagesTall = False
End With

The Set Landscape macro I have written as :

With ActiveSheet.PageSetup
.Orientation = xlPortrait
.Zoom = 100
End With

I have also written those 2 macros with everything you get when you record
a
macro and set Portrait and Landscape manually. Same problem.
Question: What is happening to cause this and what should I do
differently?
Thanks for taking the time to read this rather lengthy dissertation. Otto





 
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
Excel hanging... Jambo Excel Discussion (Misc queries) 1 May 30th 08 03:13 PM
Can you use a hanging indent in an Excel cell? DBTI Excel Discussion (Misc queries) 1 July 8th 05 09:08 PM
Can you use hanging indents in Excel? TPA59 Excel Discussion (Misc queries) 1 June 2nd 05 09:42 PM
Excel hanging up Dave Peterson[_3_] Excel Programming 0 September 9th 04 07:10 PM
Hanging Instances Of EXCEL.EXE? MDW Excel Programming 1 July 9th 04 03:27 PM


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