ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to set excel column width from visual C++ using COM automation? (https://www.excelbanter.com/excel-programming/333764-how-set-excel-column-width-visual-c-using-com-automation.html)

[email protected]

How to set excel column width from visual C++ using COM automation?
 
I am writing a Visual C++ 6.0 client which need to launch Excel and
display some data using Excel COM automation interface. How can I
programmatically set the column width of a particular column (e.g.
column 3) in Excel?

I can easily achieve this in VB as follow:

sheet.Columns(3).ColumnWidth = 40

But I cannot do this in C++ because the method

LPDISPATCH _Worksheet::GetColumns()

does not take any argument. I believe this method return a Range
object.

How can I set the width of column 3 using C++?

Thanks



All times are GMT +1. The time now is 11:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com