Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old July 11th, 2005, 07:26 AM
NeVrBorn NeVrBorn is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 6 NeVrBorn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 13 m 54 sec
Reputation Power: 0
FillColor and Border Help in excel

Trying to fill a color (yellow) and set a border (bottom) on the first row in an excel sheet from a vbscript. I don't get any errormessages with the fill color, but neither does the color appear. With the borders I get the errormessage "unknown runtime error"...can someone help?

----------------

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Open("h:\csvtoexcel\dust.xls")

With objExcel

'------ FillColor ------
.Range("A1").Select
With objExcel.Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With

'------ Set Borders ------
.Range("A1").Select
.Selection.Borders(xlDiagonalDown).LineStyle = xlNone '<--- error message "unknown runtime error"
.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
.Selection.Borders(xlEdgeLeft).LineStyle = xlNone
.Selection.Borders(xlEdgeTop).LineStyle = xlNone
With objexcel.Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
.Selection.Borders(xlEdgeRight).LineStyle = xlNone
.Selection.Borders(xlInsideVertical).LineStyle = xlNone

end with

Reply With Quote
  #2  
Old July 11th, 2005, 07:39 AM
NeVrBorn NeVrBorn is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 6 NeVrBorn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 13 m 54 sec
Reputation Power: 0
Figured out the color thing myself... replaced xlSolid with 1, and whoops....the first row is yellow

Reply With Quote
  #3  
Old July 11th, 2005, 09:57 AM
mehere's Avatar
mehere mehere is offline
Senior Sarcasm Wizardess
ASP Free God 16th Plane (12500 - 12999 posts)
 
Join Date: Feb 2005
Location: Dreamland
Posts: 12,867 mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)mehere User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 10976 Folding Title: Novice Folder
Time spent in forums: 4 Months 4 Weeks 15 h 21 m 57 sec
Reputation Power: 1762
You can't use the 'xl' Constants in the code, you need to replace them with their corresponding numbers ...
For example:
Code:
.Range("A1").Select
.Selection.Borders(5).LineStyle = -4142 '<--- error message "unknown runtime error"
.Selection.Borders(6).LineStyle = -4142
.Selection.Borders(7).LineStyle = -4142
.Selection.Borders(8).LineStyle = -4142
With objexcel.Selection.Borders(9)
.LineStyle = 1
.Weight = 2
.ColorIndex = -4105
End With
.Selection.Borders(10).LineStyle = -4142
.Selection.Borders(11).LineStyle = -4142
__________________
Come JOIN the party!!!

Quote of the Month:
Retirement: Because you've given so much of yourself to the company that you don't have anything left we can use.

Questions to Ponder:
What do you do when you see an endangered animal eating an endangered plant?

iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm")
copyright© 2008 sbenj69

Reply With Quote
  #4  
Old July 12th, 2005, 02:19 AM
NeVrBorn NeVrBorn is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 6 NeVrBorn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 13 m 54 sec
Reputation Power: 0
Thanks!!

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > FillColor and Border Help in excel


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT