PC Review


Reply
Thread Tools Rate Thread

Can Excel 2003 VBA work in Excel 2002?

 
 
=?Utf-8?B?QWRyaWFuIEM=?=
Guest
Posts: n/a
 
      16th Jan 2007
Dear All

I undertook some programming in Excel 2003 but my new employer only uses
Excel 2002 (10.6823.6817) SP3. The hyperlinks, drop-down menus and
calcuations all seem to work fine but the program was written such that when
it was opened a box appeared asking for a password so that only the "It
Administrator" could get into it and amend it. This Userform no longer
appears and I keep getting a "compile error" box coming up when I navigate
between screens.

The code for the box asking for the password is given below. Is there any
way this will work in Excel 2002?

Thanks !

Private Sub CommandButton1_Click()
Unload UserForm14


Restart:
Dim UserName As String
Dim FirstSpace As Integer
Do Until UserName <> ""
UserName = InputBox("Please enter your password: ", _
"IT Administrator Password")
Loop
FirstSpace = InStr(UserName, " ")
If FirstSpace <> 0 Then
UserName = Left(UserName, FirstSpace - 1)
End If
If UserName = "keeppawsoff" Then
Application.ScreenUpdating = False
Worksheets("Setup").Activate
Range("B50") = "False"
Worksheets("Basic").Activate
Worksheets("Setup").Activate
Range("A1").Select
Application.ScreenUpdating = True
Exit Sub
End If

Ans = MsgBox("You have entered an incorrect password - Try again?",
vbRetryCancel, "IT Administrator Password")
Select Case Ans

Case vbRetry
UserName = ""
GoTo Restart

Case vbCancel
UserForm14.Show

End Select


End Sub

Private Sub CommandButton2_Click()
Application.ScreenUpdating = False

Worksheets("Setup").Activate
Range("B50") = "TRUE"

Unload UserForm14
Worksheets("Basic").Activate
Worksheets("Setup").Activate
Range("A1").Select
Application.ScreenUpdating = True
End Sub

Private Sub UserForm_Click()

End Sub

--
Adrian C
 
Reply With Quote
 
 
 
 
Jim Cone
Guest
Posts: n/a
 
      16th Jan 2007
Adrian,

Re: "This Userform no longer appears"

Post the code that makes the Userform appear and identify where
is it located.
Are you using an add-in or a standard workbook?
Are the worksheet names "identical" on all users machines?
Like that user name. <g>
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware




----- Original Message -----
From: "Adrian C" <(E-Mail Removed)>
Newsgroups: microsoft.public.excel.programming
Sent: Tuesday, January 16, 2007 2:00 AM
Subject: Can Excel 2003 VBA work in Excel 2002?
Dear All
I undertook some programming in Excel 2003 but my new employer only uses
Excel 2002 (10.6823.6817) SP3. The hyperlinks, drop-down menus and
calcuations all seem to work fine but the program was written such that when
it was opened a box appeared asking for a password so that only the "It
Administrator" could get into it and amend it. This Userform no longer
appears and I keep getting a "compile error" box coming up when I navigate
between screens.
The code for the box asking for the password is given below. Is there any
way this will work in Excel 2002?
Thanks !

Private Sub CommandButton1_Click()
Unload UserForm14
Restart:
Dim UserName As String
Dim FirstSpace As Integer
Do Until UserName <> ""
UserName = InputBox("Please enter your password: ", _
"IT Administrator Password")
Loop
FirstSpace = InStr(UserName, " ")
If FirstSpace <> 0 Then
UserName = Left(UserName, FirstSpace - 1)
End If
If UserName = "keeppawsoff" Then
Application.ScreenUpdating = False
Worksheets("Setup").Activate
Range("B50") = "False"
Worksheets("Basic").Activate
Worksheets("Setup").Activate
Range("A1").Select
Application.ScreenUpdating = True
Exit Sub
End If

Ans = MsgBox("You have entered an incorrect password - Try again?",
vbRetryCancel, "IT Administrator Password")
Select Case Ans
Case vbRetry
UserName = ""
GoTo Restart
Case vbCancel
UserForm14.Show
End Select
End Sub

Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
Worksheets("Setup").Activate
Range("B50") = "TRUE"
Unload UserForm14
Worksheets("Basic").Activate
Worksheets("Setup").Activate
Range("A1").Select
Application.ScreenUpdating = True
End Sub

Private Sub UserForm_Click()

End Sub
--
Adrian C
C
 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      16th Jan 2007
I don't think the problem is in this code, this is code for the form, so the
problem seems to be in code that invokes the form, and/or worksheet activate
code.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Adrian C" <(E-Mail Removed)> wrote in message
news:35B82B26-589B-4D1E-859B-(E-Mail Removed)...
> Dear All
>
> I undertook some programming in Excel 2003 but my new employer only uses
> Excel 2002 (10.6823.6817) SP3. The hyperlinks, drop-down menus and
> calcuations all seem to work fine but the program was written such that

when
> it was opened a box appeared asking for a password so that only the "It
> Administrator" could get into it and amend it. This Userform no longer
> appears and I keep getting a "compile error" box coming up when I navigate
> between screens.
>
> The code for the box asking for the password is given below. Is there any
> way this will work in Excel 2002?
>
> Thanks !
>
> Private Sub CommandButton1_Click()
> Unload UserForm14
>
>
> Restart:
> Dim UserName As String
> Dim FirstSpace As Integer
> Do Until UserName <> ""
> UserName = InputBox("Please enter your password: ", _
> "IT Administrator Password")
> Loop
> FirstSpace = InStr(UserName, " ")
> If FirstSpace <> 0 Then
> UserName = Left(UserName, FirstSpace - 1)
> End If
> If UserName = "keeppawsoff" Then
> Application.ScreenUpdating = False
> Worksheets("Setup").Activate
> Range("B50") = "False"
> Worksheets("Basic").Activate
> Worksheets("Setup").Activate
> Range("A1").Select
> Application.ScreenUpdating = True
> Exit Sub
> End If
>
> Ans = MsgBox("You have entered an incorrect password - Try again?",
> vbRetryCancel, "IT Administrator Password")
> Select Case Ans
>
> Case vbRetry
> UserName = ""
> GoTo Restart
>
> Case vbCancel
> UserForm14.Show
>
> End Select
>
>
> End Sub
>
> Private Sub CommandButton2_Click()
> Application.ScreenUpdating = False
>
> Worksheets("Setup").Activate
> Range("B50") = "TRUE"
>
> Unload UserForm14
> Worksheets("Basic").Activate
> Worksheets("Setup").Activate
> Range("A1").Select
> Application.ScreenUpdating = True
> End Sub
>
> Private Sub UserForm_Click()
>
> End Sub
>
> --
> Adrian C



 
Reply With Quote
 
 
 
Reply

Thread Tools
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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
.NET Win Forms Application to Excel 2002, Excel 2003, and Excel 20 MaxGruven Microsoft Excel Programming 0 3rd Mar 2008 10:48 PM
Macro to work both in Excel 2002 and Excel 2003 HA14 Microsoft Excel Programming 5 16th May 2007 03:21 AM
Can'nt open excel worksheet (created in excel 2002) in excel 2003 =?Utf-8?B?Z29sYWJp?= Microsoft Excel Crashes 0 20th Jun 2006 10:08 AM
Simple Macro, works in Excel 2002, 2003 but won't work in 2000 DJA Microsoft Excel Programming 5 28th Sep 2005 05:10 PM
Excel 2000 VBA App Now Works in Excel 2003, but not Excel 2002 bobkaku Microsoft Excel Programming 0 11th Mar 2005 02:07 AM


Features
 

Advertising
 

Newsgroups
 


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