PC Review


Reply
Thread Tools Rate Thread

Another "Object doesn't support..."

 
 
davegb
Guest
Posts: n/a
 
      30th Jan 2007
I have this code (still under development):

Private Sub Workbook_SheetChange(ByVal wsShName As Object, ByVal
Target As Range)

If Right(wsShName.Name, 7) <> "Monthly" Then 'ignore these sheeets
Select Case wsShName.Name
Case "(Code Key)" 'Excluded sheets
Exit Sub

Case Else 'if password hasn't been entered yet, then ask
for password
If bPwrdEntrd = False Then

Call PasswordEntry
End If
End Select
End If

End Sub
Sub PasswordEntry()
Dim rFoundShName As Range
Dim rShNames As Range
Dim wsPwrdNames As Worksheet
'Dim sPwrd As String

Set wsPwrdNames = ThisWorkbook.Sheets("sheet1")
Set rShNames = wsPwrdNames.Range("A1:A8")
wsPwrdNames.Visible = True

ufPwrdEntry.Show

Set rFoundShName = rShNames.Find(ActiveSheet.Name, _
LookIn:=xlValues, _
LookAt:=xlWhole)

If sPwrd = rFoundShName.Offset(1, 0).Value Then
bPwrdEntrd = True

End If
wsPwrdNames.Visible = False

End Sub

And this code in the userform:

Sub cbOK_Click()
sPwrd = ufPwrdEntry.tbPwrdEntry.Text <---- OBJECT DOESN'T SUPPORT
THIS....
If sPwrd = "" Then
MsgBox "Please enter the password to access this worksheet.",
vbOKCancel
End If
End Sub

I tried changing the .text to .value, but that didn't help.

Any ideas on why?

Thanks!

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      30th Jan 2007
First, I'm not sure why you changed the workbook_sheetchange arguments from:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

Second, I don't see where you declared sPwrd.
Is that in a General module like:
Public sPwrd as string

Third, check your typing.
Since the routine is behind the UserForm, I think I'd use code like:

sPwrd = me.tbPwrdEntry.Text
(Me is the object that owns the code--in this case, the userform.)

Are you sure tbPwrdEntry is really a textbox?



davegb wrote:
>
> I have this code (still under development):
>
> Private Sub Workbook_SheetChange(ByVal wsShName As Object, ByVal
> Target As Range)
>
> If Right(wsShName.Name, 7) <> "Monthly" Then 'ignore these sheeets
> Select Case wsShName.Name
> Case "(Code Key)" 'Excluded sheets
> Exit Sub
>
> Case Else 'if password hasn't been entered yet, then ask
> for password
> If bPwrdEntrd = False Then
>
> Call PasswordEntry
> End If
> End Select
> End If
>
> End Sub
> Sub PasswordEntry()
> Dim rFoundShName As Range
> Dim rShNames As Range
> Dim wsPwrdNames As Worksheet
> 'Dim sPwrd As String
>
> Set wsPwrdNames = ThisWorkbook.Sheets("sheet1")
> Set rShNames = wsPwrdNames.Range("A1:A8")
> wsPwrdNames.Visible = True
>
> ufPwrdEntry.Show
>
> Set rFoundShName = rShNames.Find(ActiveSheet.Name, _
> LookIn:=xlValues, _
> LookAt:=xlWhole)
>
> If sPwrd = rFoundShName.Offset(1, 0).Value Then
> bPwrdEntrd = True
>
> End If
> wsPwrdNames.Visible = False
>
> End Sub
>
> And this code in the userform:
>
> Sub cbOK_Click()
> sPwrd = ufPwrdEntry.tbPwrdEntry.Text <---- OBJECT DOESN'T SUPPORT
> THIS....
> If sPwrd = "" Then
> MsgBox "Please enter the password to access this worksheet.",
> vbOKCancel
> End If
> End Sub
>
> I tried changing the .text to .value, but that didn't help.
>
> Any ideas on why?
>
> Thanks!


--

Dave Peterson
 
Reply With Quote
 
davegb
Guest
Posts: n/a
 
      30th Jan 2007
On Jan 30, 1:21 pm, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> First, I'm not sure why you changed the workbook_sheetchange arguments from:
>
> Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
>


Thanks for your reply.
I didn't think they had to be by those specific names. I changed them
to a format I use so I can tell what kind of variable it is. I changed
them back.

> Second, I don't see where you declared sPwrd.
> Is that in a General module like:
> Public sPwrd as string
>


sPwrd is declared in another general module as you've described.

> Third, check your typing.
> Since the routine is behind the UserForm, I think I'd use code like:
>
> sPwrd = me.tbPwrdEntry.Text


I used the name of the form rather than "me". I don't really
understand the "me" thing, but it worked!

> (Me is the object that owns the code--in this case, the userform.)
>
> Are you sure tbPwrdEntry is really a textbox?
>
>
>
>
>
> davegb wrote:
>
> > I have this code (still under development):

>
> > Private Sub Workbook_SheetChange(ByVal wsShName As Object, ByVal
> > Target As Range)

>
> > If Right(wsShName.Name, 7) <> "Monthly" Then 'ignore these sheeets
> > Select Case wsShName.Name
> > Case "(Code Key)" 'Excluded sheets
> > Exit Sub

>
> > Case Else 'if password hasn't been entered yet, then ask
> > for password
> > If bPwrdEntrd = False Then

>
> > Call PasswordEntry
> > End If
> > End Select
> > End If

>
> > End Sub
> > Sub PasswordEntry()
> > Dim rFoundShName As Range
> > Dim rShNames As Range
> > Dim wsPwrdNames As Worksheet
> > 'Dim sPwrd As String

>
> > Set wsPwrdNames = ThisWorkbook.Sheets("sheet1")
> > Set rShNames = wsPwrdNames.Range("A1:A8")
> > wsPwrdNames.Visible = True

>
> > ufPwrdEntry.Show

>
> > Set rFoundShName = rShNames.Find(ActiveSheet.Name, _
> > LookIn:=xlValues, _
> > LookAt:=xlWhole)

>
> > If sPwrd = rFoundShName.Offset(1, 0).Value Then
> > bPwrdEntrd = True

>
> > End If
> > wsPwrdNames.Visible = False

>
> > End Sub

>
> > And this code in the userform:

>
> > Sub cbOK_Click()
> > sPwrd = ufPwrdEntry.tbPwrdEntry.Text <---- OBJECT DOESN'T SUPPORT
> > THIS....
> > If sPwrd = "" Then
> > MsgBox "Please enter the password to access this worksheet.",
> > vbOKCancel
> > End If
> > End Sub

>
> > I tried changing the .text to .value, but that didn't help.

>
> > Any ideas on why?

>
> > Thanks!

>
> --
>
> Dave Peterson- Hide quoted text -
>
> - Show quoted text -



 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      30th Jan 2007
They can be changed--there's someone who changes them so that they match company
standards--but it's pretty unusual.

I'd guess that you misspelled the name of the userform if the "me." stuff
worked.

davegb wrote:
>
> On Jan 30, 1:21 pm, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> > First, I'm not sure why you changed the workbook_sheetchange arguments from:
> >
> > Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
> >

>
> Thanks for your reply.
> I didn't think they had to be by those specific names. I changed them
> to a format I use so I can tell what kind of variable it is. I changed
> them back.
>
> > Second, I don't see where you declared sPwrd.
> > Is that in a General module like:
> > Public sPwrd as string
> >

>
> sPwrd is declared in another general module as you've described.
>
> > Third, check your typing.
> > Since the routine is behind the UserForm, I think I'd use code like:
> >
> > sPwrd = me.tbPwrdEntry.Text

>
> I used the name of the form rather than "me". I don't really
> understand the "me" thing, but it worked!
>
> > (Me is the object that owns the code--in this case, the userform.)
> >
> > Are you sure tbPwrdEntry is really a textbox?
> >
> >
> >
> >
> >
> > davegb wrote:
> >
> > > I have this code (still under development):

> >
> > > Private Sub Workbook_SheetChange(ByVal wsShName As Object, ByVal
> > > Target As Range)

> >
> > > If Right(wsShName.Name, 7) <> "Monthly" Then 'ignore these sheeets
> > > Select Case wsShName.Name
> > > Case "(Code Key)" 'Excluded sheets
> > > Exit Sub

> >
> > > Case Else 'if password hasn't been entered yet, then ask
> > > for password
> > > If bPwrdEntrd = False Then

> >
> > > Call PasswordEntry
> > > End If
> > > End Select
> > > End If

> >
> > > End Sub
> > > Sub PasswordEntry()
> > > Dim rFoundShName As Range
> > > Dim rShNames As Range
> > > Dim wsPwrdNames As Worksheet
> > > 'Dim sPwrd As String

> >
> > > Set wsPwrdNames = ThisWorkbook.Sheets("sheet1")
> > > Set rShNames = wsPwrdNames.Range("A1:A8")
> > > wsPwrdNames.Visible = True

> >
> > > ufPwrdEntry.Show

> >
> > > Set rFoundShName = rShNames.Find(ActiveSheet.Name, _
> > > LookIn:=xlValues, _
> > > LookAt:=xlWhole)

> >
> > > If sPwrd = rFoundShName.Offset(1, 0).Value Then
> > > bPwrdEntrd = True

> >
> > > End If
> > > wsPwrdNames.Visible = False

> >
> > > End Sub

> >
> > > And this code in the userform:

> >
> > > Sub cbOK_Click()
> > > sPwrd = ufPwrdEntry.tbPwrdEntry.Text <---- OBJECT DOESN'T SUPPORT
> > > THIS....
> > > If sPwrd = "" Then
> > > MsgBox "Please enter the password to access this worksheet.",
> > > vbOKCancel
> > > End If
> > > End Sub

> >
> > > I tried changing the .text to .value, but that didn't help.

> >
> > > Any ideas on why?

> >
> > > Thanks!

> >
> > --
> >
> > Dave Peterson- Hide quoted text -
> >
> > - Show quoted text -


--

Dave Peterson
 
Reply With Quote
 
davegb
Guest
Posts: n/a
 
      31st Jan 2007
On Jan 30, 2:59 pm, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> They can be changed--there's someone who changes them so that they match company
> standards--but it's pretty unusual.
>
> I'd guess that you misspelled the name of the userform if the "me." stuff
> worked.
>


I checked it about 10 times, but you never know...
Thanks again, Dave!

>
>
>
>
> davegb wrote:
>
> > On Jan 30, 1:21 pm, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> > > First, I'm not sure why you changed the workbook_sheetchange arguments from:

>
> > > Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

>
> > Thanks for your reply.
> > I didn't think they had to be by those specific names. I changed them
> > to a format I use so I can tell what kind of variable it is. I changed
> > them back.

>
> > > Second, I don't see where you declared sPwrd.
> > > Is that in a General module like:
> > > Public sPwrd as string

>
> > sPwrd is declared in another general module as you've described.

>
> > > Third, check your typing.
> > > Since the routine is behind the UserForm, I think I'd use code like:

>
> > > sPwrd = me.tbPwrdEntry.Text

>
> > I used the name of the form rather than "me". I don't really
> > understand the "me" thing, but it worked!

>
> > > (Me is the object that owns the code--in this case, the userform.)

>
> > > Are you sure tbPwrdEntry is really a textbox?

>
> > > davegb wrote:

>
> > > > I have this code (still under development):

>
> > > > Private Sub Workbook_SheetChange(ByVal wsShName As Object, ByVal
> > > > Target As Range)

>
> > > > If Right(wsShName.Name, 7) <> "Monthly" Then 'ignore these sheeets
> > > > Select Case wsShName.Name
> > > > Case "(Code Key)" 'Excluded sheets
> > > > Exit Sub

>
> > > > Case Else 'if password hasn't been entered yet, then ask
> > > > for password
> > > > If bPwrdEntrd = False Then

>
> > > > Call PasswordEntry
> > > > End If
> > > > End Select
> > > > End If

>
> > > > End Sub
> > > > Sub PasswordEntry()
> > > > Dim rFoundShName As Range
> > > > Dim rShNames As Range
> > > > Dim wsPwrdNames As Worksheet
> > > > 'Dim sPwrd As String

>
> > > > Set wsPwrdNames = ThisWorkbook.Sheets("sheet1")
> > > > Set rShNames = wsPwrdNames.Range("A1:A8")
> > > > wsPwrdNames.Visible = True

>
> > > > ufPwrdEntry.Show

>
> > > > Set rFoundShName = rShNames.Find(ActiveSheet.Name, _
> > > > LookIn:=xlValues, _
> > > > LookAt:=xlWhole)

>
> > > > If sPwrd = rFoundShName.Offset(1, 0).Value Then
> > > > bPwrdEntrd = True

>
> > > > End If
> > > > wsPwrdNames.Visible = False

>
> > > > End Sub

>
> > > > And this code in the userform:

>
> > > > Sub cbOK_Click()
> > > > sPwrd = ufPwrdEntry.tbPwrdEntry.Text <---- OBJECT DOESN'T SUPPORT
> > > > THIS....
> > > > If sPwrd = "" Then
> > > > MsgBox "Please enter the password to access this worksheet.",
> > > > vbOKCancel
> > > > End If
> > > > End Sub

>
> > > > I tried changing the .text to .value, but that didn't help.

>
> > > > Any ideas on why?

>
> > > > Thanks!

>
> > > --

>
> > > Dave Peterson- Hide quoted text -

>
> > > - Show quoted text -

>
> --
>
> Dave Peterson- Hide quoted text -
>
> - Show quoted text -



 
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
Re: ActiveX "Object doesn't support this property or method" error Leon Lambert Microsoft C# .NET 0 13th Mar 2009 10:11 AM
Re: ActiveX "Object doesn't support this property or method" error Pavel Minaev Microsoft C# .NET 1 12th Mar 2009 11:46 PM
"Object doesn't support this property or method" in Excel 2003 rhiski12 Microsoft Excel Misc 3 24th Nov 2008 03:58 PM
Referenced object on subform gets "object doesn't support this property or method" Brandon Schultz Microsoft Access Forms 1 1st Feb 2007 05:06 PM
"object doesn't support this property or method" in MS Project Tutorial! ctk Windows XP Internet Explorer 1 14th Aug 2003 09:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:23 AM.