Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default VB6 and Excel question

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default VB6 and Excel question

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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default VB6 and Excel question

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
  #4   Report Post  
Posted to microsoft.public.excel.programming
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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 Macro/VB Question DDE Question MadDog22 Excel Worksheet Functions 1 March 10th 10 01:47 AM
The question is an excel question that I need to figure out howto do in excel. Terry Excel Worksheet Functions 3 January 23rd 06 06:22 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 0 April 27th 05 07:46 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 23 April 23rd 05 09:26 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 0 April 22nd 05 03:30 PM


All times are GMT +1. The time now is 07:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"