-
Your on the right track...
Its up to you to create what ever entries you want to hold there with SaveSetting.
GetSetting allows you to define a default return value if there is nothing there... you can see how to implement that with the code below
GetSetting/SaveSetting deals with the HKEY_CURRENT_USER\Software\VB and VBA Program Settings section of the registry, meaning that its specific to that user for that workstation.
The structure beneath that level is:
KEY (normally your App name, e.g. "FOI")
SECTION (the name of the section, e.g. "UserProfile")
SETTING (the name of the setting, e.g. "Role")
VALUE (the value of the setting, e.g. "Director")
So if you want to add more info to the user profile, like the user name, last used date, etc, then you would add more SETTING's with their VALUE's under the same KEY>SECTION
For the example of the user Role, I would suggest you move back to using the global variable to hold the value - it will be set when the addin loads (if it's not there, the user can then be propmted to enter one) and can then be read when the form is loaded.[VBA]'declared in a standard module
Public strUserRole As String
'#############################
Sub setup()
'the original setup routine
Set myMenuBar = CommandBars.ActiveMenuBar
Set newMenu = myMenuBar.Controls.Add(Type:=msoControlPopup, Temporary:=True)
newMenu.Caption = "FileNameSave"
newMenu.OnAction = "FOI"
'initialze the global variable with the reg setting
strUserRole = GetSetting("APPNAME", "UserProfile", "Role", "Nothing")
'If it hasn't been set, show the input box
If strUserRole = "Nothing" Then
SaveUserRole
End If
End Sub
'#############################
Sub SaveUserRole()
'initialze the global variable user prompt
strUserRole = InputBox("Enter your Post", "Amend User", "<Post Title>")
'and save the setting
SaveSetting "APPNAME", "UserProfile", "Role", strUserRole
End Sub[/VBA]
K :-)

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules