LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default MsgBox that will open only once.

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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Workbooks.Open suppresses MsgBox Displays when Macro is run MichaelDavid Excel Programming 4 October 3rd 08 12:38 AM
msgbox muddan madhu Excel Worksheet Functions 2 April 14th 08 05:06 AM
First MsgBox. Need help RAP Excel Programming 3 August 3rd 05 09:13 PM
Hyperlink to open a common dialog on a msgbox Harinath Excel Programming 1 April 28th 04 03:33 PM
auto close while MsgBox is open Kevin Excel Programming 2 November 10th 03 12:36 AM


All times are GMT +1. The time now is 09:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"