User Form/Input box problem

P

Peter

Dear all
I hope someone can help me with the following couple of problems.

I have created a spreadsheet to record the use of our telephone system,
number of calls, reason, operator etc, to make things easier I have created
a user form which is displayed from a Command Button on the worksheet. What
I am trying to achieve is:-
1) Display a input box when the work book is first opened prompting the user
to enter their name. The inputed name is 'saved' so that when the user form
is called up the name is already entered into a text box. Once the various
text boxes and option buttons have been completed the details are saved to
the spreadsheet, including the staff members name, and the user form
dismissed again from a command button on the user form but the operators
name is still available for use when the user form is called up again. Which
brings me onto the second problem: -
2) The workbook is shared between up to 17 users, I can write the code so
that as the user form is called up it automatically does a save so that it
picks any additions saved by other users but how do I automatically accept
any changes that have been made rather than having to click on the button to
accept the changes?

We are using Windows 2K and Office 2000

Any assistance would be gratefully received
 
B

Bob Phillips

Hi Peter,

First point. Don't bother with the in put box, get the users login id with
this code

Public Declare Function GetUserName Lib "advapi32.dll" _
Alias "GetUserNameA" _
(ByVal lpBuffer As String, _
nSize As Long) As Long

Public Function UserName() As String
Dim sName As String * 256
Dim cChars As Long
cChars = 256
If GetUserName(sName, cChars) Then
UserName = Left$(sName, cChars - 1)
End If
End Function

You can call UserName in the Workbok_Open event, and save it tgo a global
variable.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top