Hi Dave
I won't be playing with the registry with VBA because this is all new to me and
don't really know what I'm doing but will keep it for future, BTW
I've got the save workbook covered in the instruction,so if they don't save,
great, they get the message a second time.
Your comment are always appreciated.
Regards
John
"Dave Peterson" wrote in message
...
It depends on what you do and how you do it.
That SaveSetting and GetSetting stuff built into VBA limits how much damage
you
can do. (There are other ways to lots more damage.)
VBAs help for each of them shows examples.
Basically, something like this:
Option Explicit
Private Sub Workbook_Open()
Dim TestValue As Long
TestValue = GetSetting(appname:=Me.Name, _
section:="StartUp", _
Key:="ShowMsg", _
Default:=0)
If TestValue = 0 Then
'change the registry
SaveSetting appname:=Me.Name, _
section:="StartUp", _
Key:="ShowMsg", _
setting:=1
MsgBox "Please read the instructions!"
End If
End Sub
There's also a DeleteSetting that you can use to delete your entry in the
registry--nice to clean up while you're testing.
This is commented, but you can add it to your code.
' DeleteSetting appname:=Me.Name, _
' section:="StartUp", _
' Key:="ShowMsg"
(It only deletes the key--not the branch.)
But if you're snooping (and be careful!). Any change you make to the registry
is immediate. There are no "are you sure" prompts.
Windows start button|Run
Regedit
traverse to:
HKCU\software\VB and VBA Program Settings\appname\section\key
And you'll see how/where it's stored.
=========
JE McGimpsey has some more options for keeping track of stuff like this:
http://mcgimpsey.com/excel/udfs/sequentialnums.html
Ryan H wrote:
Ha ha, I had a "Freudian Slip". Since I have taken an interest in
programming I wish I would have got my B.S. in Computer Science instead of
Physics. Isn't it kinda of dangerous to mess with peoples registries? Is it
easy or very involved to access someones registery to do what John is needing
to do?
--
Cheers,
Ryan
"Bob Phillips" wrote:
He said registry not directory. Every user has their own registry.
HTH
Bob
"Ryan H" wrote in message
...
Good point Dave. How do you check the users directory?
--
Cheers,
Ryan
"Dave Peterson" wrote:
Both Bob and Chip gave you code that creates a new name in the workbook.
But if
the workbook doesn't get saved, then the next time it's opened, the
msgbox will
appear again.
You could add this line to either procedure -- right above the "End Sub"
line:
ThisWorkbook.Save
ps. Remember that if 100's of people will be opening the workbook, then
this
technique will only show the msgbox to the first person who opens that
workbook
without the name.
After the name is created, then all the other users won't see the msgbox
even
once.
One way around this is to store a value in the user's registry and check
for
that using SaveSetting and GetSetting.
John wrote:
Hi Everyone
Is it possible to have a popup window ( Msgbox ) that will open only
one time.
The first time the workbook will be open, I would like to show the
message
"Please read the instruction first".
I don't want the message to keep opening every time the workbook is
open.
Regards
John
--
Dave Peterson
.
.
--
Dave Peterson