Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Manipulating Excel Spreadsheets from VB6 (not VBA).

Status
Not open for further replies.

cehagema

Programmer
Oct 2, 2003
9
US
Howdy- I'm reading SQL Server tables with VB6 and writing the results to Excel Spreadsheets. The syntax in VB6 differs slightly from VBA when manipulating Excel objects. In general; has anyone seen a comprehensive reference on this subject (I can't find anything on Microsoft's sight). In particular; how to accomplish:

"Columns("A:B").ColumnWidth = 10"

(a VBA command) using VB6

Any help would be appreciated. Thanks-- Chris
 
You just need to start from a point in the object hierarchy to which you have a reference. Say you only have a reference to the Application object, the statement might look like:

Set objApp = CreateObject("Excel.Application")
objApp.ActiveSheet.Columns("A:B").ColumnWidth = 10

Or you might have a reference to a particular sheet already.

objSheet.Columns("A:B").ColumnWidth = 10

Paul Bent
Northwind IT Systems
 
Thanks Paul... That works. And it opened my slow mind.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top