How to set excel column width from visual C++ using COM automation?

N

ningjun.wang

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
 

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