View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] ningjun.wang@lexisnexis.com is offline
external usenet poster
 
Posts: 1
Default 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