text justification in excel

  • Thread starter Thread starter krollenhagen
  • Start date Start date
K

krollenhagen

I am creating an excel spreadsheet from vb.net 2005. I followed the
advice of some other posts on how to "Center Text in Excel" by creating
a macro in excel to do what I want and then looking at the code.

"oSheet.Range("F3").HorizontalAlignment = xlRight" is what was posted
there. When I try this, I get an error of "xlRight is not declared"

What do I declare it as?

Thanks
 
krollenhagen said:
I am creating an excel spreadsheet from vb.net 2005. I followed the
advice of some other posts on how to "Center Text in Excel" by creating
a macro in excel to do what I want and then looking at the code.

"oSheet.Range("F3").HorizontalAlignment = xlRight" is what was posted
there. When I try this, I get an error of "xlRight is not declared"

What do I declare it as?

Thanks

Look at what type of object HorizonatlAligment expects. It will be
something system.something.horizontalAligment.xlright
chris
 
Is there a way to get vb to recognize the xlLeft, xlRight, xlCenter,
etc.. names instead of having to figure out what the corresponding
integer is?

I am having trouble getting the borders to work properly. There are a
lot more options than left, center and right in the borders to guess
which integer corresponds to a given style, color, weight, etc...

Thank you,
 
Back
Top