Access to Excel Coding HELP =(

G

Guest

Hey,
I'm formatting excel via Access.
Most of the code (from klatuu) works.

Some stuff returns error messages though.

For instances,
xlSheet.Range("C3:E10").Borders.LineStyle = xlContinuous
works

while,
xlSheet.Range("C3:E10").Borders.Weight = Thin
returns
"Error #1004: Unable to set the Weight property of the Borders class"


..Columns(1).HorizontalAlignment = xlCenter
returns
"Error #1004: Unable to set the Horizontal Alignment property of the Range
class"


Any Help/Advice would be really Really Appreciated.
Thanks~
 
G

Guest

because there were a bunch of pre existing tables + queries I needed in
Access, Plus the people i'm writing the program for are comfortable with
access. Just sorta automating their process of transferring the data from
access to excel, then making it look "pretty".
 
G

Guest

I ran the macro recorder in excel and it produced the same results from the
original post. =(

Hopefully someone has an aswer to this.
 
G

Guest

hi Kaseano,

try this
xlSheet.Range("C3:E10").Borders.Weight = xlThin

ExcelSheet.Application.Columns(1).Select
With ExcelSheet.Application.Selection
.HorizontalAlignment = xlCenter
End With

HTH Paolo
 
G

Guest

"unable to set the Weight property of the Border class"

"unable to set the HorizontalAlignment property of the Range class" =(

this sucks.
 
K

Keith Wilby

Kaseano said:
"unable to set the Weight property of the Border class"

"unable to set the HorizontalAlignment property of the Range class" =(

this sucks.

This works for me.

Dim objSht As Excel.Worksheet
Dim objRange As Range

Set objRange = objSht.Range("A1").CurrentRegion

With objRange
.Select
.Borders.Weight = xlThin
End With

Set objRange = Nothing
Set objSht = Nothing

HTH - Keith.
www.keithwilby.com
 
G

Guest

bah turns out I didn't have excel in the Access VB references.
Sorry for being dumb, thanks for all the responses everyone.
 

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