Computing.Net > Forums > Office Software > Excel WINNT Macro

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Excel WINNT Macro

Reply to Message Icon

Name: Gary1949
Date: October 28, 2009 at 05:23:39 Pacific
OS: Windows XP
Product: Microsoft Microsoft excel 2000
Subcategory: Microsoft Office
Comment:

Restrict, or allow, the alteration of a spreadsheet, by selected people, that is on a shared network, based on WINNT user ID. This should be transparent and users that are allowed will never see a message. However, users that are restricted will only see a message if they try to alter the file.



Sponsored Link
Ads by Google

Response Number 1
Name: DerbyDad03
Date: October 28, 2009 at 08:28:14 Pacific
Reply:

Is there a question in there some place?


0

Response Number 2
Name: Gary1949
Date: October 28, 2009 at 08:43:34 Pacific
Reply:

Yes. I'm interested in an Excel macro to do all of this.


0

Response Number 3
Name: DerbyDad03
Date: October 28, 2009 at 09:52:11 Pacific
Reply:

Oh, I see.

Typically, the etiquette followed in this forum (and most others) is to actually ask for assistance as opposed to just announcing a set or requirements and expecting people to supply a solution. People want to help, but posts come across as sort of arrogant when all they do is read like a list of demands. I'm sure you didn't mean to have it sound that way, but it does.

That said, and since we don't know your level of expertise in VBA, I'll offer this as a starting point:

Sub WhatUser()
 curUser = Application.UserName
End Sub

This will set curUser to the UserName of the person logged into the machine at the time that the macro is run.

The current UserName could be compared to a list of allowed UserNames, perhaps stored in a hidden sheet, and if found, the sheet to be edited could be unprotected and then protected again when saved.

Obviously, the code module that contained the Password to unprotect the sheet would have to be hidden and password protected also.

Let us know if you need any further assistance.


0

Response Number 4
Name: Gary1949
Date: October 28, 2009 at 10:00:33 Pacific
Reply:

First time user, and far from arrogant. Thanks for the advise, and suggested solution.


0

Response Number 5
Name: DerbyDad03
Date: October 28, 2009 at 10:14:20 Pacific
Reply:

re: far from arrogant

I thought so! :)

I just played with this under my own UserName and it did indeed unprotect Sheet1:

Sub UnProtectByUser()
 With Sheets(2).Range("A1:A10")
  Set c = .Find(Application.UserName, LookIn:=xlValues)
    If Not c Is Nothing Then
        Sheets(1).Unprotect Password:="pw"
    End If
 End With
End Sub

Protecting the sheet could be done with a BeforeSave macro.


1

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

cab file error Excel 2007 won't print to...


Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Excel WINNT Macro

Excel worksheets / Macros www.computing.net/answers/office/excel-worksheets-macros/8832.html

deleting a row in Excel 2000 macro www.computing.net/answers/office/deleting-a-row-in-excel-2000-macro/1875.html

Sharing Excel Macros across files www.computing.net/answers/office/sharing-excel-macros-across-files/4476.html