Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2006

Tip: Looking for answers? Try searching our database.

Resising Columns in vb code.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Camper Joe - 24 Mar 2006 11:50 GMT
Hi.

I am trying to resize my columns in Excel through VB6.

I have created my excel.appliation object (xl) and created a new workbook.
Now I want to use the code:

xl.Cells(1, 1).Width = 100, but I get: Unable to set the width property of
the Range class.

Even when I try
xl.Columns(2).Width = 100

I get the same error.
MSRoach@gmail.com - 24 Mar 2006 12:12 GMT
What about:

xl.Columns("A:A").ColumnWidth = 100  

(any range) in place of A:A
Stefi - 24 Mar 2006 12:39 GMT
Try
   ActiveWorkbook.ActiveSheet.Columns("B:B").ColumnWidth = 100

You can replace ActiveWorkbook and ActiveSheet with other valid WB and WS
references if necessary.

Regards,
Stefi

„Camper Joe” ezt írta:

> Hi.
>
[quoted text clipped - 10 lines]
>
> I get the same error.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.