Controlling column widths in interactive web page output

C

Chris Collingridge

Hi,

Apology: Already posted in excel.worksheet.functions a few days ago, but
think this may be more appropriate location. Apologies if you're reading it
twice.

I'm having an issue with column widths when generating an interactive HTML
page from an Excel sheet. Basically, although the columns are set up with
the proper widths in Excel (and these widths are respected when generating
static HTML) they appear narrower when the interactive web version is
displayed.

I can't find anything about this problem anywhere in the help, the web, or
on newsgroups, but it seems to me as though the proportions of the columns
are staying the same - it's that the web view (because of the big useless
white border - any suggestions on that welcome) is smaller so the columns
become narrower.

I need my columns to stay the width they're set up as in Excel. Is there any
way to explicitly set pixel values for column width for exporting to
interactive HTML? Or any other way around the problem?

Thanks,
Chris
 
J

JMay

As a last resort, with no other options you might try something like the
following. I wrote it to autofit my sheet PLUS to add 3 additional
spaces
at the end to have it look a bit more unbuntched.

Sub AutoFitPlus3Spaces()
Dim LCol As Long
Dim CurrCol As Range
Dim MyCol As Integer
Dim Dcol As String
Dim i As Integer
ActiveCell.SpecialCells(xlLastCell).Select
LCol = Selection.Column
MyCol = LCol + 64
Dcol = Chr(MyCol)
Application.Range("A:" & Dcol).Columns.AutoFit
For i = 1 To LCol
Set myrng = Range(Cells(1, i), Cells(Rows.Count, i))
If Application.WorksheetFunction.CountA(myrng) > 0 Then
Columns(i).ColumnWidth = Int(Columns(i).ColumnWidth) + 3 'change
to suit
End If
Next i
End Sub

HTH,
Jim May
 

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