View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default open w/book with password

The following userform code asking for a password to open another w/book..
at which line I should insert code,(what code) to open another w/book called
"sales"
Private Sub cmdLogin_Click()
With Me.TextBox1
If .Text < ThisWorkbook.Worksheets("Sheet1") _
Range("R1").Value Then 'sheet1cell"R1" contains password
MsgBox "Invalid Password !", vbCritical
'assumes current path and xl2003 or earlier, if xl2007, need file ext.
mod.
Workbooks.Open (ThisWorkbook.Path & "\sales.xls", Password:="<password"
SelStart = 0
SelLength = Len(.Text)
SetFocus
Else: Unload Me
End If
End With
End Sub




"tkraju via OfficeKB.com" <u16627@uwe wrote in message
news:94cd3cd633d9e@uwe...
The following userform code asking for a password to open another
w/book..
at which line I should insert code,(what code) to open another w/book
called
"sales"
Private Sub cmdLogin_Click()
With Me.TextBox1
If .Text < ThisWorkbook.Worksheets("Sheet1") _
Range("R1").Value Then 'sheet1cell"R1" contains password
MsgBox "Invalid Password !", vbCritical
SelStart = 0
SelLength = Len(.Text)
SetFocus
Else: Unload Me
End If
End With
End Sub

--
Message posted via http://www.officekb.com