+ Reply to Thread
Results 1 to 4 of 4

Macros & passwords

  1. #1
    Chris
    Guest

    Macros & passwords

    Hi

    I need to create a password protected macro.

    By this I don't mean the code (already done) but the ability to launch the
    macro itself. I am sending a spreadsheet out and it has several macros
    inbeded. I got one macro that I am the only one to use and needs to be
    protected against others launching it. Any Ideas?

  2. #2
    Paul B
    Guest

    Re: Macros & passwords

    Chris, here is one way,

    Sub PassWord_To_Run()
    'must lock VBA project so you can't see the password in it
    Dim MyStr1 As String, MyStr2 As String
    With ActiveSheet
    MyStr2 = ("123") 'This is the password and it is CASE sensitive
    MyStr1 = InputBox("Password Is Required To Run this Macro ")
    If MyStr1 = MyStr2 Then

    'your code here

    Else
    MsgBox ("Access Denied")
    End If
    End With
    End Sub


    --
    Paul B
    Always backup your data before trying something new
    Please post any response to the newsgroups so others can benefit from it
    Feedback on answers is always appreciated!
    Using Excel 2002 & 2003

    "Chris" <Chris@discussions.microsoft.com> wrote in message
    news:FB8DC4A2-73E6-4BB5-9BD7-AFDA9AA2C6A6@microsoft.com...
    > Hi
    >
    > I need to create a password protected macro.
    >
    > By this I don't mean the code (already done) but the ability to launch the
    > macro itself. I am sending a spreadsheet out and it has several macros
    > inbeded. I got one macro that I am the only one to use and needs to be
    > protected against others launching it. Any Ideas?




  3. #3
    Chris
    Guest

    Re: Macros & passwords

    Perfect, exactly what I needed!

    Thanks

    "Paul B" wrote:

    > Chris, here is one way,
    >
    > Sub PassWord_To_Run()
    > 'must lock VBA project so you can't see the password in it
    > Dim MyStr1 As String, MyStr2 As String
    > With ActiveSheet
    > MyStr2 = ("123") 'This is the password and it is CASE sensitive
    > MyStr1 = InputBox("Password Is Required To Run this Macro ")
    > If MyStr1 = MyStr2 Then
    >
    > 'your code here
    >
    > Else
    > MsgBox ("Access Denied")
    > End If
    > End With
    > End Sub
    >
    >
    > --
    > Paul B
    > Always backup your data before trying something new
    > Please post any response to the newsgroups so others can benefit from it
    > Feedback on answers is always appreciated!
    > Using Excel 2002 & 2003
    >
    > "Chris" <Chris@discussions.microsoft.com> wrote in message
    > news:FB8DC4A2-73E6-4BB5-9BD7-AFDA9AA2C6A6@microsoft.com...
    > > Hi
    > >
    > > I need to create a password protected macro.
    > >
    > > By this I don't mean the code (already done) but the ability to launch the
    > > macro itself. I am sending a spreadsheet out and it has several macros
    > > inbeded. I got one macro that I am the only one to use and needs to be
    > > protected against others launching it. Any Ideas?

    >
    >
    >


  4. #4
    Paul B
    Guest

    Re: Macros & passwords

    Your welcome, thanks for the feedback

    --
    Paul B
    Always backup your data before trying something new
    Please post any response to the newsgroups so others can benefit from it
    Feedback on answers is always appreciated!
    Using Excel 2002 & 2003

    "Chris" <Chris@discussions.microsoft.com> wrote in message
    news:29D0CFCB-2324-489A-A1E0-F5599856818D@microsoft.com...
    > Perfect, exactly what I needed!
    >
    > Thanks
    >
    > "Paul B" wrote:
    >
    > > Chris, here is one way,
    > >
    > > Sub PassWord_To_Run()
    > > 'must lock VBA project so you can't see the password in it
    > > Dim MyStr1 As String, MyStr2 As String
    > > With ActiveSheet
    > > MyStr2 = ("123") 'This is the password and it is CASE sensitive
    > > MyStr1 = InputBox("Password Is Required To Run this Macro ")
    > > If MyStr1 = MyStr2 Then
    > >
    > > 'your code here
    > >
    > > Else
    > > MsgBox ("Access Denied")
    > > End If
    > > End With
    > > End Sub
    > >
    > >
    > > --
    > > Paul B
    > > Always backup your data before trying something new
    > > Please post any response to the newsgroups so others can benefit from it
    > > Feedback on answers is always appreciated!
    > > Using Excel 2002 & 2003
    > >
    > > "Chris" <Chris@discussions.microsoft.com> wrote in message
    > > news:FB8DC4A2-73E6-4BB5-9BD7-AFDA9AA2C6A6@microsoft.com...
    > > > Hi
    > > >
    > > > I need to create a password protected macro.
    > > >
    > > > By this I don't mean the code (already done) but the ability to launch

    the
    > > > macro itself. I am sending a spreadsheet out and it has several macros
    > > > inbeded. I got one macro that I am the only one to use and needs to be
    > > > protected against others launching it. Any Ideas?

    > >
    > >
    > >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1