Column width reset

A

Andy Thomas

I have just started to experience a very strange problem that
hopefully someone may recognise.

Note that this only happening on my machine and the code runs
perfectly well on other machines . The problem has only come to light
since our support desk made a change to my Windows profile. The
problem may be caused by this change but I am hoping expert Excel
resources may be able to help explain the problem.

I have code to populate worksheets with data, within which I check for
pagebreaks and add lines and text to get around natural constraints
that Excel has for page headers. However, when I run the following
line (even if this returns False) Excel changes the column widths of
columns to a large random value (usually 255 pts)

If Worksheets(strsheetname).Rows(introw).PageBreak <> xlNone Then

In have stepped through the code and actually can see the worksheet
format change as this line is processed.

Thanks for any feedback.
 
J

Jim Rech

I have no idea why it would cause this problem but since you've had your
profile changed and because it involves printing, I'd suggest seeing what
happens if you change to another printer. Even a pretend one like Adobe or
MS XPS in the File, Print dialog.

--
Jim
|I have just started to experience a very strange problem that
| hopefully someone may recognise.
|
| Note that this only happening on my machine and the code runs
| perfectly well on other machines . The problem has only come to light
| since our support desk made a change to my Windows profile. The
| problem may be caused by this change but I am hoping expert Excel
| resources may be able to help explain the problem.
|
| I have code to populate worksheets with data, within which I check for
| pagebreaks and add lines and text to get around natural constraints
| that Excel has for page headers. However, when I run the following
| line (even if this returns False) Excel changes the column widths of
| columns to a large random value (usually 255 pts)
|
| If Worksheets(strsheetname).Rows(introw).PageBreak <> xlNone Then
|
| In have stepped through the code and actually can see the worksheet
| format change as this line is processed.
|
| Thanks for any feedback.
 
A

Andy Thomas

Thanks Jim, though printing isn't involved. This behaviour occurs
when formatting data on a spreadsheet.
 
J

Jim Rech

Andy-

I know you weren't print. That's not the point. Excel uses the print
driver internally anytime you do something involving printing, like setting
page breaks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top