Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Freeze Excel?

Status
Not open for further replies.

xlStar

Technical User
Nov 16, 2003
55
GB
I write macros to manipulate text files, some takes a while to complate the whole job. Other department now have my macro, but when they start running the Excel macro they manually switch over to other applications therefore causing the macro to crashed and they blamed me!

Is there a way of freezing the windows so the only Excel is shown on screen until the macro finished? i.e. the users can able to toggle over to other application?
 
Wouldn't it be easier to look at your macro and work out why it relies on active windows?

You could post your macro code in a post, but it will get a better response if you post in the VBA Visual Basic For Applications (Microsoft) forum rather than here.


Cheers, Glenn.

Did you hear about the literalist show-jumper? He broke his nose jumping against the clock.
 
GlennUK

Once place where it crashed is the setting the Print Range.
I suppose its the "ActiveSheet" is the problem, can you make any improvement here?





Sub PrintOther(yend, xend)

ActiveSheet.PageSetup.PrintArea = "$A$1:$" & yend & "$" & xend

With ActiveSheet.PageSetup
.CenterFooter = "&A"
.LeftMargin = Application.InchesToPoints(0.3)
.RightMargin = Application.InchesToPoints(0.3)
.TopMargin = Application.InchesToPoints(0.33)
.BottomMargin = Application.InchesToPoints(0.7)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.33)
.Orientation = xlLandscape
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With

End Sub
 
I thought you said that this was working and was too slow, so how come it's crashing now?

What are the values of yend and xend?

Cheers, Glenn.

Did you hear about the literalist show-jumper? He broke his nose jumping against the clock.
 
GlennUK.

The yellow debugger stop at the ".LeftMargin = Application.InchesToPoints(0.3)". This only happen when user switch over to other applications; which therefore I am assuming the word "ActiveSheet" is the problem!

The yend and xend depend on column letter and row number.
i.e, the range might be as $A$1:$M$40


 
Have you tried replacing Activesheet with Sheet("sheetname")?

Cheers, Glenn.

Did you hear about the literalist show-jumper? He broke his nose jumping against the clock.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top