Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Resising Columns in vb code.

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Resising Columns in vb code.

What about:

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

(any range) in place of A:A

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Resising Columns in vb code.

Try
ActiveWorkbook.ActiveSheet.Columns("B:B").ColumnWi dth = 100

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

Regards,
Stefi


€˛Camper Joe€¯ ezt Ć*rta:

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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
vb code to hide columns pm tlb Excel Discussion (Misc queries) 4 May 28th 09 09:36 AM
Help with VB code to compare two columns Farooq Sheri Excel Programming 3 January 23rd 06 11:10 AM
Code not hiding columns Eva Shanley[_2_] Excel Programming 3 September 2nd 04 06:13 PM
sizing columns in code JulieD Excel Programming 2 July 29th 04 04:29 PM
CODE TO ADD TWO COLUMNS BASED ON ANOTHER Gauthier Excel Programming 1 October 5th 03 03:20 AM


All times are GMT +1. The time now is 10:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"