automation question: need to center a column

K

kim

Please forgive me, as this is my first time to post
something here....and I'm not very experienced with Access
programming.

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 column headings on
the spreadsheet, but I don't know how to do this. I
assumed it would be object.Alignment = 2, 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.
 
K

kim

I found my answer on Experts Exchange:

The correct syntax should be:

objExcel.Cells(3, 3).HorizontalAlignment = xlCenter
 

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