Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

VB Script- Unknown Run Time Error

1,388 views
Skip to first unread message

Vasanthi

unread,
Oct 3, 2002, 11:29:51 AM10/3/02
to
Hi,

We are trying to select a particular range of cells and
border the cells in an Excel Worksheet using VBScript.It
is displaying the following error: Herewith attached the
sample.vbs file for reference.

We used the command

Script : c:\Sample.vbs
Line : 12
char : 6
Error : Unknown RunTime error
Code : 800A03EC
Source: Microsoft VB Script RunTime Error.

If any of you can provide a advise in this regard, it will
be a greate help. Appreciate your quick response.

Thanks & Regards
D. Vasanthi.

Torgeir Bakken (MVP)

unread,
Oct 3, 2002, 11:58:09 AM10/3/02
to
Vasanthi wrote:

Hi

You will need to define all your xl... constants yourself. They are not available to a WSH
vbscript.

Add this in the top of the script:

Const xlNone = -4142
Const xlCenter = -4108
Const xlDownward = -4170
Const xlNormal = -4143
Const xlAutomatic = -4105
Const xlThin = 2
Const xlLeft = -4131
Const xlRight = -4152
Const xlTop = -4160
Const xlBottom = -4107
Const xlToLeft = -4159
Const xlHorizontal = -4128
Const xlToRight = -4161
Const xlSolid = 1
Const xlDiagonalDown = 5
Const xlDiagonalUp = 6
Const xlEdgeLeft = 7
Const xlEdgeTop = 8
Const xlEdgeBottom = 9
Const xlEdgeRight = 10
Const xlInsideVertical = 11
Const xlInsideHorizontal = 12
Const xlContinuous = 1

--
torgeir
Microsoft MVP Scripting and WMI
Porsgrunn Norway


l...@safedatausa.com

unread,
Oct 3, 2002, 11:56:37 AM10/3/02
to
I think I might have a solution for this problem. Your sample.vbs
file contains Excel constants (those variables that starte with "xl").
I think you will have to use their actual values in VBS. I changed
line 12 to read:
.Selection.Borders(5).LineStyle = -4142
and the error moved to line 13 - which to me would indicate that the
source of your problem is the 'constants'.
I bet you used the Macro editor in Excel to get the code :-) Not
being a VB programmer these constants gave me a fit until I accidently
stumbled onto their values.

Lee

l...@safedatausa.com

unread,
Oct 3, 2002, 12:01:28 PM10/3/02
to
I think I might have a solution for this problem. Your sample.vbs
file contains Excel constants (those variables that starte with "xl").
I think you will have to use their actual values in VBS. I changed
line 12 to read:
.Selection.Borders(5).LineStyle = -4142
and the error moved to line 13 - which to me would indicate that the
source of your problem is the 'constants'.
I bet you used the Macro editor in Excel to get the code :-) Not
being a VB programmer these constants gave me a fit until I accidently
stumbled onto their values.

Lee


On Thu, 3 Oct 2002 08:29:51 -0700, "Vasanthi"
<vdevar...@covansys.com> wrote:

atchdjr

unread,
Oct 3, 2002, 12:05:48 PM10/3/02
to
here is a exsample out of a book....hope it helps
EXCEL.VBS

Joe Fawcett

unread,
Oct 3, 2002, 12:16:28 PM10/3/02
to
"Vasanthi" <vdevar...@covansys.com> wrote in message
news:1122e01c26af1$b707f5d0$3aef2ecf@TKMSFTNGXA09...
You're referencing constants that aren't defined so you are getting them
treated as 0.
.Selection.Borders(xlDiagonalDown).LineStyle = xlNone 'What are
xlDiagonalDown and xlNone?

Joe


0 new messages