#1   Report Post  
Posted to microsoft.public.excel.programming
bob bob is offline
external usenet poster
 
Posts: 52
Default vb macro

I have a vb macro running in an excel97 document that
works fine on an NT/2000 PC. However, when I run the same
macro from and XP Pro workstation I am getting errors and
they seem to be related to not having variables
dimensioned. What could be my problem?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default vb macro

Bob

please post the code (not an attachment)

Regards

Trevor


"bob" wrote in message
...
I have a vb macro running in an excel97 document that
works fine on an NT/2000 PC. However, when I run the same
macro from and XP Pro workstation I am getting errors and
they seem to be related to not having variables
dimensioned. What could be my problem?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default vb macro

Bob,

Are you specifying the variables in your code (such as):
Dim x as Long
Public y as String
Static a as Range

And is Option Explicit at the top of the Module?

--
sb
"bob" wrote in message
...
I have a vb macro running in an excel97 document that
works fine on an NT/2000 PC. However, when I run the same
macro from and XP Pro workstation I am getting errors and
they seem to be related to not having variables
dimensioned. What could be my problem?



  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default vb macro

No not all variables are dimensioned and Option Explicit
is not in the module. I didn't write the code, it was
written by someone else who no longer works here. What's
strange is that the same code works great on an NT machine
but not on XP.
For instance, in the following code the 'PIC' variable is
not dimensioned, however, it must be in order for the code
to function on an XP workstation but on the NT machine it
works fine. I am finding this situation all throughout
the code.

Private Sub Apply_Click()
If IsNumeric(RPM.Value) And IsNumeric(D.Value) And
IsNumeric(R.Value) And IsNumeric(L.Value) And IsNumeric
(A.Value) Then
If RPM.Value 0 And D.Value 0 And R.Value 0
And L.Value 0 And A.Value = 0 Then
Tread.RPM = RPM.Value: Tread.Ra = D.Value:
Tread.Rf = R.Value: Tread.Rr = L.Value: Tread.FDC = A.Value
If I11cw.Visible = True Then Tread.ROT =
1: Tread.CONFIG = -1: PIC = "C:\1ICW.bmp"
If I11ccw.Visible = True Then Tread.ROT = -
1: Tread.CONFIG = -1: PIC = "C:\1ICCW.bmp"
If I14cw.Visible = True Then Tread.ROT =
1: Tread.CONFIG = 1: PIC = "C:\1IVCW.bmp"
If I14ccw.Visible = True Then Tread.ROT = -
1: Tread.CONFIG = 1: PIC = "C:\1IVCCW.bmp"
If I21cw.Visible = True Then Tread.ROT =
1: Tread.CONFIG = 1: PIC = "C:\2ICW.bmp"
If I21ccw.Visible = True Then Tread.ROT = -
1: Tread.CONFIG = 1: PIC = "C:\2ICCW.bmp"
If I22cw.Visible = True Then Tread.ROT =
1: Tread.CONFIG = -1: PIC = "C:\2IICW.bmp"
If I22ccw.Visible = True Then Tread.ROT = -
1: Tread.CONFIG = -1: PIC = "C:\2IICCW.bmp"
If I33cw.Visible = True Then Tread.ROT =
1: Tread.CONFIG = 1: PIC = "C:\3IIICW.bmp"
If I33ccw.Visible = True Then Tread.ROT = -
1: Tread.CONFIG = 1: PIC = "C:\3IIICCW.bmp"
If I34cw.Visible = True Then Tread.ROT =
1: Tread.CONFIG = -1: PIC = "C:\3IVCW.bmp"
If I34ccw.Visible = True Then Tread.ROT = -
1: Tread.CONFIG = -1: PIC = "C:\3IVCCW.bmp"
If I42cw.Visible = True Then Tread.ROT =
1: Tread.CONFIG = 1: PIC = "C:\4IICW.bmp"
If I42ccw.Visible = True Then Tread.ROT = -
1: Tread.CONFIG = 1: PIC = "C:\4IICCW.bmp"
If I43cw.Visible = True Then Tread.ROT =
1: Tread.CONFIG = -1: PIC = "C:\4IIICW.bmp"
If I43ccw.Visible = True Then Tread.ROT = -
1: Tread.CONFIG = -1: PIC = "C:\4IIICCW.bmp"
Worksheets("Export Sheet").Cells(11, 2).Value
= PP.Value + "-" + RP.Value + "-" + CR.Value
Worksheets("Export Sheet").Cells(11, 4).Value
= RPM.Value
Worksheets("Export Sheet").Cells(12, 2).Value
= D.Value
Worksheets("Export Sheet").Cells(13, 2).Value
= R.Value
Worksheets("Export Sheet").Cells(12, 4).Value
= L.Value
Worksheets("Export Sheet").Cells(13, 4).Value
= A.Value
Worksheets("EXPORT SHEET").Activate
Range("G10").Select
Sheet11.Pictures.Insert(PIC).Select
GIF.Hide
Sheet1.LabNumberSegs.Enabled = True:
Sheet1.LabNumSeg.Enabled = True: Sheet1.NumSegSp.Enabled =
True
Sheet1.Done.Enabled = True
Else: GWF.Show
End If
Else: GWF.Show
End If
End Sub




-----Original Message-----
Bob,

Are you specifying the variables in your code (such as):
Dim x as Long
Public y as String
Static a as Range

And is Option Explicit at the top of the Module?

--
sb
"bob" wrote in

message
...
I have a vb macro running in an excel97 document that
works fine on an NT/2000 PC. However, when I run the

same
macro from and XP Pro workstation I am getting errors

and
they seem to be related to not having variables
dimensioned. What could be my problem?



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default vb macro

Can't speak for XP (it's an unknown for me). But you'll need to find each
error and figure out how to fix it (there are some differences between XP
and 97).

If you add Option Explict - Excel will help pinpoint some (if not all) of
the
problem areas. Use Debug Compile to get to them.

You may have to step through your code using F8 to see where the
problems are.

You can also use the Watch window to see the value and how Excel
defines the variable types providing you Dim each variable without setting
its type (this way Excel sees them as Variant and then set them). When
you're finished go back and define the variables.

--
sb
wrote in message
...
No not all variables are dimensioned and Option Explicit
is not in the module. I didn't write the code, it was
written by someone else who no longer works here. What's
strange is that the same code works great on an NT machine
but not on XP.
For instance, in the following code the 'PIC' variable is
not dimensioned, however, it must be in order for the code
to function on an XP workstation but on the NT machine it
works fine. I am finding this situation all throughout
the code.

Private Sub Apply_Click()
If IsNumeric(RPM.Value) And IsNumeric(D.Value) And
IsNumeric(R.Value) And IsNumeric(L.Value) And IsNumeric
(A.Value) Then
If RPM.Value 0 And D.Value 0 And R.Value 0
And L.Value 0 And A.Value = 0 Then
Tread.RPM = RPM.Value: Tread.Ra = D.Value:
Tread.Rf = R.Value: Tread.Rr = L.Value: Tread.FDC = A.Value
If I11cw.Visible = True Then Tread.ROT =
1: Tread.CONFIG = -1: PIC = "C:\1ICW.bmp"
If I11ccw.Visible = True Then Tread.ROT = -
1: Tread.CONFIG = -1: PIC = "C:\1ICCW.bmp"
If I14cw.Visible = True Then Tread.ROT =
1: Tread.CONFIG = 1: PIC = "C:\1IVCW.bmp"
If I14ccw.Visible = True Then Tread.ROT = -
1: Tread.CONFIG = 1: PIC = "C:\1IVCCW.bmp"
If I21cw.Visible = True Then Tread.ROT =
1: Tread.CONFIG = 1: PIC = "C:\2ICW.bmp"
If I21ccw.Visible = True Then Tread.ROT = -
1: Tread.CONFIG = 1: PIC = "C:\2ICCW.bmp"
If I22cw.Visible = True Then Tread.ROT =
1: Tread.CONFIG = -1: PIC = "C:\2IICW.bmp"
If I22ccw.Visible = True Then Tread.ROT = -
1: Tread.CONFIG = -1: PIC = "C:\2IICCW.bmp"
If I33cw.Visible = True Then Tread.ROT =
1: Tread.CONFIG = 1: PIC = "C:\3IIICW.bmp"
If I33ccw.Visible = True Then Tread.ROT = -
1: Tread.CONFIG = 1: PIC = "C:\3IIICCW.bmp"
If I34cw.Visible = True Then Tread.ROT =
1: Tread.CONFIG = -1: PIC = "C:\3IVCW.bmp"
If I34ccw.Visible = True Then Tread.ROT = -
1: Tread.CONFIG = -1: PIC = "C:\3IVCCW.bmp"
If I42cw.Visible = True Then Tread.ROT =
1: Tread.CONFIG = 1: PIC = "C:\4IICW.bmp"
If I42ccw.Visible = True Then Tread.ROT = -
1: Tread.CONFIG = 1: PIC = "C:\4IICCW.bmp"
If I43cw.Visible = True Then Tread.ROT =
1: Tread.CONFIG = -1: PIC = "C:\4IIICW.bmp"
If I43ccw.Visible = True Then Tread.ROT = -
1: Tread.CONFIG = -1: PIC = "C:\4IIICCW.bmp"
Worksheets("Export Sheet").Cells(11, 2).Value
= PP.Value + "-" + RP.Value + "-" + CR.Value
Worksheets("Export Sheet").Cells(11, 4).Value
= RPM.Value
Worksheets("Export Sheet").Cells(12, 2).Value
= D.Value
Worksheets("Export Sheet").Cells(13, 2).Value
= R.Value
Worksheets("Export Sheet").Cells(12, 4).Value
= L.Value
Worksheets("Export Sheet").Cells(13, 4).Value
= A.Value
Worksheets("EXPORT SHEET").Activate
Range("G10").Select
Sheet11.Pictures.Insert(PIC).Select
GIF.Hide
Sheet1.LabNumberSegs.Enabled = True:
Sheet1.LabNumSeg.Enabled = True: Sheet1.NumSegSp.Enabled =
True
Sheet1.Done.Enabled = True
Else: GWF.Show
End If
Else: GWF.Show
End If
End Sub




-----Original Message-----
Bob,

Are you specifying the variables in your code (such as):
Dim x as Long
Public y as String
Static a as Range

And is Option Explicit at the top of the Module?

--
sb
"bob" wrote in

message
...
I have a vb macro running in an excel97 document that
works fine on an NT/2000 PC. However, when I run the

same
macro from and XP Pro workstation I am getting errors

and
they seem to be related to not having variables
dimensioned. What could be my problem?



.





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
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 08:22 PM


All times are GMT +1. The time now is 03:49 PM.

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

About Us

"It's about Microsoft Excel"