Create Excel File (Format Column Width)

#1
Hello all!

Here is my situation...I've created an Excel Spreadsheet and I load a collection using the "Write Collection".
Either before that or after that I need to be able to set the column widths.

I can do it before...if I knew how?
Or after using AutoFit...if I knew how?

Any ideas?

Thanks,
Mark
 
#2
Hi Mark,

I had the same issue today. In order to edit the column width, I duplicated and changed the ´Format Cell´ page from the ´MS Excel VBO´.

In the code stage I replaced the ´Range´ property with the ´Columns´ property, as well as the ´NumberFormat´ with ´ColumnWidth´:

Code:
GetWorkbook(handle,Nothing).ActiveSheet.Columns(columnref).ColumnWidth = (width)
View attachment 1582031763078.png

If you use a loop and a collection, you could quickly update your Excel sheet:

View attachment 1582031989218.png

Greetings and good luck!
Sjaak
 
Top