PC Review


Reply
Thread Tools Rate Thread

automation q: center text in a spreadsheet cell

 
 
kim
Guest
Posts: n/a
 
      16th Sep 2003
I'm coding a process in Access that will take the data in
the database, manipulate it, and write a spreadsheet using
automation. I would like to center the text of some cells
on the spreadsheet, but I don't know how to do this. I
assumed it would be "object.Alignment = 2" (w/o quotes),
but that isn't working for me and I get a "Run-time
error '438' Object doesn't support this property or
method" message. The actual line of code is:

objExcel.Cells(5, 3).Alignment = 2

Any help anyone can provide me would be much appreciated.


kim


 
Reply With Quote
 
 
 
 
Ken Snell
Guest
Posts: n/a
 
      17th Sep 2003
objExcel.Cells(5, 3).HorizontalAlignment=xlCenter

assuming that objExcel is a Worksheet object.

--
Ken Snell
<MS ACCESS MVP>

"kim" <(E-Mail Removed)> wrote in message
news:051c01c37c8d$16aceb50$(E-Mail Removed)...
> I'm coding a process in Access that will take the data in
> the database, manipulate it, and write a spreadsheet using
> automation. I would like to center the text of some cells
> on the spreadsheet, but I don't know how to do this. I
> assumed it would be "object.Alignment = 2" (w/o quotes),
> but that isn't working for me and I get a "Run-time
> error '438' Object doesn't support this property or
> method" message. The actual line of code is:
>
> objExcel.Cells(5, 3).Alignment = 2
>
> Any help anyone can provide me would be much appreciated.
>
>
> kim
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
HOW DO I CENTER TEXT WITHIN A CELL? minnie112685 Microsoft Excel New Users 1 5th Jul 2009 06:29 PM
How do you center text in a cell vertically, rather than horizonta sheana Microsoft Word New Users 2 6th Jan 2008 04:48 PM
Aligning the text in a given table cell via C#/Automation some guy Microsoft Powerpoint 2 17th Jan 2007 05:59 AM
Automation: Adding Text to Cell With Different Colours Manfred Senn Microsoft Excel Programming 2 24th Nov 2006 03:20 PM
how do i center text in a cell using excel using a code rather th. =?Utf-8?B?TGlzYSBU?= Microsoft Excel Misc 2 5th Nov 2004 04:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:45 PM.