LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Maintaining Excel column widths

I'm using ActiveX to copy a block from an existing Excel spreadsheet into a new Excel spreadsheet.  When I paste the block into the new spreadsheet, along with the data, I get the formatting (borders, shading etc.) that was used in the original file.  However, what I find, is that the column widhts in the new spreadsheeet stay at their default settings.  When I copy the block, I us a range of row/column designators; e.g. A1:E10.  When I paste the block into the new spreadsheet, I just refer to the upper left cell; e.g. A1.  How do I make the column widths in the new spreadsheet the same as the original spreadsheet?  I'm familiar with using a template when using the Report Generation Toolkit.  Is there a similar technique with ActiveX?

0 Kudos
Message 1 of 3
(2,816 Views)

@AT1 wrote:

I'm using ActiveX to copy a block from an existing Excel spreadsheet into a new Excel spreadsheet.  When I paste the block into the new spreadsheet, along with the data, I get the formatting (borders, shading etc.) that was used in the original file.  However, what I find, is that the column widhts in the new spreadsheeet stay at their default settings.  When I copy the block, I us a range of row/column designators; e.g. A1:E10.  When I paste the block into the new spreadsheet, I just refer to the upper left cell; e.g. A1.  How do I make the column widths in the new spreadsheet the same as the original spreadsheet?  I'm familiar with using a template when using the Report Generation Toolkit.  Is there a similar technique with ActiveX?


If the range columns are of the same width use the Range.ColumnWidth property. When you copy to the new sheet use the row/column designators A1:E10 and set this range column width property to the value of the source worksheet.

 

Ben64

0 Kudos
Message 2 of 3
(2,805 Views)

No - columns will be various widths.  Guess I'll have to address each column separately.

0 Kudos
Message 3 of 3
(2,790 Views)