Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Only Show User Form Once

Hi, once again I turn to this forum for help!

I have a workbook template (*.xlt) which, upon opening displays a
userform ("Quote_Details") into which the user enters details
(contractor name, quote number etc) of the quote they are about to
create. Once completed and the OK button is pressed this information
is sent to various places in the workbook, including headers, footers
and various cells.

The problem is that after the quote has been completed and saved it
still shows the "Quote_Details" userform upon opening.

I need the userform to only appear the first time a copy of the
template is opened and not after the copy has been named and saved. Is
this possible?

Any suggestions would be greatly appreciated.


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Only Show User Form Once

Hi

There's a couple of things you could add in to the macro to determine
whether to show the userform or not...

Assuming that the quote number is inserted in cell A1 and is blank until the
user has completed the required details you could do:

if (range("A1").value="") then quote_details.show

Then when the quote number gets written to A1 (i.e. once the user has
finished with the form). Variations on this include reserving cell "A50000"
(or similar) for a system only use cell - set it to TRUE if the form needs
showing or FALSE once the details have been completed

if range("A50000") then quote_details.show

Hope this helps

David



"cornishbloke" wrote in message
...
Hi, once again I turn to this forum for help!

I have a workbook template (*.xlt) which, upon opening displays a
userform ("Quote_Details") into which the user enters details
(contractor name, quote number etc) of the quote they are about to
create. Once completed and the OK button is pressed this information
is sent to various places in the workbook, including headers, footers
and various cells.

The problem is that after the quote has been completed and saved it
still shows the "Quote_Details" userform upon opening.

I need the userform to only appear the first time a copy of the
template is opened and not after the copy has been named and saved. Is
this possible?

Any suggestions would be greatly appreciated.


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Only Show User Form Once

Cornish,

Suggestion.

Write a flag/switch to the registry when that form completes. In your
workbook open code, test the flag in the registry, if set, don't show the
form. You can use GetSetting and SaveSetting as simple registry read/writes.
The flag could be set with#

SaveSetting appname:="MyApp", _
section:=ActiveWorkbook.Name, _
key:="FirstTime", _
setting:="False"

and the open code would be something like

Private Sub Workbook_Open()
Dim sFlag As String

On Error Resume Next
sFlag = GetSetting(appname:="MyApp", _
section:=ActiveWorkbook.Name, _
key:="FirstTime")
On Error GoTo 0

If sFlag < "False" Then
Quote_Details.Show
End If

End Sub

--

HTH

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

"cornishbloke" wrote in message
...
Hi, once again I turn to this forum for help!

I have a workbook template (*.xlt) which, upon opening displays a
userform ("Quote_Details") into which the user enters details
(contractor name, quote number etc) of the quote they are about to
create. Once completed and the OK button is pressed this information
is sent to various places in the workbook, including headers, footers
and various cells.

The problem is that after the quote has been completed and saved it
still shows the "Quote_Details" userform upon opening.

I need the userform to only appear the first time a copy of the
template is opened and not after the copy has been named and saved. Is
this possible?

Any suggestions would be greatly appreciated.


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
COM COM is offline
external usenet poster
 
Posts: 40
Default Only Show User Form Once

Only problem with using registry entries, is that if the file is moved to another computer, or accessed by a different logged in user, then the registry values will not be present, or at least not the same. This depends on your forseeable use of the program, and forecasting how your "company" will work in the future. A more robust method would be suggested, as one a company could change it's method of doing business at any time, and no reason to lose out on a well written program by a thoughtful programmer.. I think it looks better to be someone that plans for change and remembered for the good quality of work, rather than someone that has caused great losses by not thinking ahead. Of course helps even more if others understand the problem faced, and see/recognize how you were able to overcome it.

A little social engineering thrown into this vast world of computer programming.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Only Show User Form Once

I'd rather do it the way David suggested, use a cell I'd be sure that it
won't be needed to enter any data into. Using registry for this purpose is a
misuse of it, it contains much too much garbage to put even more in it.
Besides, keeping the flag in the workbook will ensure that the user form
won't show even if You open the workbook on another machine, registry won't.



Reply
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
show user form Joanne Links and Linking in Excel 1 February 27th 08 07:52 AM
SHow user form when opening workbook Wanna Learn Excel Discussion (Misc queries) 2 June 26th 07 06:30 PM
Use a text box to calculate and show results in a user form stockpick Excel Discussion (Misc queries) 6 August 6th 05 06:04 AM
Show user form, leave wosksheet active Wric Smith Excel Programming 3 December 4th 03 08:46 PM
I am looking to see if anybody has an equivalant user form to Outlooks CONTACT form BruceJ[_2_] Excel Programming 2 October 15th 03 05:28 PM


All times are GMT +1. The time now is 01:16 AM.

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

About Us

"It's about Microsoft Excel"