Can't comment without looking at the actual files, but hope the workbook you are trying to open is an excel 2003- version, and that you have modified the .xlsm above to xls
Sam On Fri, Nov 18, 2011 at 2:02 AM, TAschefler <river...@hotmail.com> wrote: > Thanks Sam and Paul for the responses. > > I actually found code on a site that will do exactly what i am looking > for. It verifies username and forces macros as well. The code works > great when I test it out on my computer...(using Excel 2010/WIN7). > When I set up for an employees computer (he is using Excel 2003/XP) > the prompt box to enter the password to open the workbook comes up to > get into the workbook. I do not have a password to modify in the > document, just a password to open. > > Is there something lost in the conversion process from a .xlsm to > earlier version of excel that is causing the password to not > automatically be entered? Any help will be appreciated. Here is the > code below: > > Option Explicit > Private Sub Workbook_Open() > > Dim UserName As String > Dim V As Variant > Dim myPWD As String > Dim wkbk As Workbook > > UserName = Environ("username") > > myPWD = "password" > > On Error Resume Next > V = Application.Match(UserName, > ThisWorkbook.Worksheets("UserNames").Range("a:a"), 0) > On Error GoTo 0 > > If IsError(V) = True Then > MsgBox "You're not authorized!" > Else > Set wkbk = Workbooks.Open(Filename:="C:\Documents and Settings > \johnsmith\Desktop\book1.xlsm", _ > Password:=myPWD) > > wkbk.RunAutoMacros which:=xlAutoOpen > End If > > ThisWorkbook.Close savechanges:=False > > End Sub > > > -- > FORUM RULES (934+ members already BANNED for violation) > > 1) Use concise, accurate thread titles. Poor thread titles, like Please > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > will not get quick attention or may not be answered. > > 2) Don't post a question in the thread of another member. > > 3) Don't post questions regarding breaking or bypassing any security > measure. > > 4) Acknowledge the responses you receive, good or bad. > > 5) Cross-promotion of, or links to, forums competitive to this forum in > signatures are prohibited. > > NOTE : Don't ever post personal or confidential data in a workbook. Forum > owners and members are not responsible for any loss. > > > ------------------------------------------------------------------------------------------------------ > To post to this group, send email to excel-macros@googlegroups.com > -- Sam Mathai Chacko -- FORUM RULES (934+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com