View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default VB6 and Excel question

I would expect the constants to remain, er, constant. But there are some
differences between versions. And it's better to verify than to guess.

Robert wrote:

On Dec 3, 12:32 pm, Dave Peterson wrote:
Do you have a reference to excel 2007 in your VB project?

If no, then it won't know what those constants are--xledgeleft, xledgetop, ...
and xlhairline.

You can replace them with their numeric constants.

Open excel (I use xl2003, so you'll want to do the same to verify the numbers):

Open the VBE
hit ctrl-g to see the immediate window
type:
?xledgeleft
and hit enter
I see 7 in xl2003.

I see 1 with:
?xlhairline

So that first line of code would look like:
xlWS.Columns("A:K").Borders(7).Weight = 1

You'll want to check all those constants.



Robert wrote:

Hello,
I'm using VB6 and Excel 2007. I have a program that creates a report
then
opens it in an Excel spreadsheet. I have done a lot of formatting but
cannot figure out how to get it to do lines (ie: hairline). I tried
the
following code but it doesn't work:


xlWS.Columns("A:K").Borders(xlEdgeLeft).Weight = xlHairline
xlWS.Columns("A:K").Borders(xlEdgeTop).Weight = xlHairline
xlWS.Columns("A:K").Borders(xlEdgeBottom).Weight = xlHairline
xlWS.Columns("A:K").Borders(xlEdgeRight).Weight = xlHairline
xlWS.Columns("A:K").Borders(xlInsideVertical).Weig ht = xlHairline
xlWS.Columns("A:K").Borders(xlInsideHorizontal).We ight = xlHairline


Any ideas?


Thank you,
Robert


--

Dave Peterson


Thank you Dave!!! I've been trying to do this for several weeks!
By the way, the numeric constants appear to be the same.

Robert


--

Dave Peterson