index > Visual Basic for Applications (VBA) > VBA Userform Control of multiple userform controls

VBA Userform Control of multiple userform controls


I have built a data entry VBA application in Excel so we can input data electronically instead of manually on paper only. I created a series of Userforms to display one at a time to "walk thru" the test procedure and allow entry of the data for one section at a time. The problem I have is that I am trying to use the standard form controls "frmTest.Hide" or "Unload Me" when done with the forms. Then if I wish to redisplay one or more of the forms for re-entry use "Load frmTest" and/or just frmtest.Show if old form just hidden. I am seeing that the old forms are not hiding or unloading and worse when I try to redisplay with either the "Load frmTest" if previously unloaded and "frmTest.show" I get a VBA error that it cannot display in modal the form. I thought the forms were supposed to work like VB? Anyone know what's going on. I have looked thru the VBA Programming Reference and my reference books on VBA and unable to find an answer.
Sunshine Design

Hello,

You need to explain a bit more of what you are trying to do or maybe even post a bit of code. From the limited details you have provided you seem to be using the correct instructions but you need to think out the logic.

Post some code!

Chas

ChasAA

I have several forms that I am trying to manage a user thru to enter test data with test procedure prompts.I have a main intro form, several test prompt and input forms and a final close form to review, save and print the data report sheet in excel.

I want the user to be able to navigate between the forms. Using the "frmTest.Hide" command does not hide the form and "Unload frmTest" does not unload the form. The forms are staying persistant in the view space. They do decrease in view Z-Order, but they do not go away or become hidden with the form commands. The old forms persist in the background. So when I then try to go back to some of the forms to allow re-entry of data, for instance, I get an error that VBA does not allow modal forms to be displayed and the application errors and quits. These are typical form commands in VB6 and have worked successfully with VB6 without issues. So why does VBA have a problem managing forms and controlling what is visible or loaded, which form can be active and how would one then make forms hidden or unloaded in VBA. By the way, I had code command examples in my original post. Please advise if this makes my primary post more understandable.

Sunshine Design

I was able to find my answer. In VBA you must set the Userform to nonmodal for the .Hide method and the Unload to work properly. the default mode is modal, which does not allow use of the .hide method or unloading forms at run time.

Sunshine Design
reply 4

You can use google to search for other answers

 

More Articles

• Password protecting to a command button in Excel?
• Run-time error 13, "Type Mismatch" in Excel application
• vba in excel
• Help: Why does double-click on a customized ActiveX object lead m...
• Trying to get VB to update charts in Excel
• List Box Selection via Code (Access 2003)
• tables
• Changes to the forum (a little long, sorry)
• QueryTable Refresh and ODBC connection
• Count the rows
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

• Cannot close all instances of excel afte
• Difference between FORMS and CONTROL TOO
• Openening an Excel file from within Proj
• Copying range of cells to another worksh
• Autosave using VBA after n minutes
• Runtime Error #13 Type mismatch
• VBA Excel: PivotTable Visibility and Piv
• so lost and buried in help printouts
• Loosing Reference to Common Objects (i.s
• Please, How change a class name in VBA E
• Excel 2003 - hiding a row question
• On Error not catching problem with a web
• VBA Shell Function / Windows API Create
• How to preserve the date format while re
• Access Link Table with Outlook Problem

Hot Articles

• excel load event
• How do I execute code when I open a work
• Commandbar excel bug for "Document
• Unable to trust makecert signed COM Add-
• Collections Class For Each Next
• I dont know whether you have come across
• Access Developer Extensions
• Security of source code in vba
• Can't change the format of an unbound la
• VBA Module to DLL
• reformat TOC (table of content) and wri
• Reading text file and accessing specific
• usrfrm initialize
• Adding a worksheet to the workbook
• RunTime Error 7 - Out of Memory

Recommend Articles

• Refreshing a web query that is behind a
• how to close a userform in workbooks.ope
• VB.Net to VBA?
• ACCESS 2003 OLE
• Put E-mail In From Field
• Event handling for dynamically created c
• Task Scheduler
• Program code fro sorting coloumns in a l
• Question reg BeforeDoubleClick event in
• Please help me to print the label for th
• drop down files in directory list in Word
• overflow error 6
• Trying to get just the file name
• Excel VBA - Worksheet_Change problem?
• Collating Data from Multiple Excel Sheets