Collins, Darryl
Darryl.Collins at anz.com
Thu Mar 18 23:34:08 CDT 2010
"A form would be a good thing but I don't know how to create one, how to open it, push text to controls on it etc." Hi John, To create a form, goto the VBE and Choose "Insert" > "User Form" from the menu. This will create a form in the code window that can be viewed (and toggled) between an Object View (which looks like the form) and a code view (which will show you the underlying code for the form). Adding controls etc is pretty much like in Access, although in Access you create your forms in the app rather than the VBE. To make the form visible to the user in the app you need some additional code in a module like this '===================================================================== Sub ShowMyForm() Application.ScreenUpdating = True frmMyTestForm.Show End Sub '===================================================================== The code underlying the form is just like in Access: You can toggle between Form view and code view in the VBE by right mouse clicking in the project explorer or form itself. For example here is a basic example that returns values to a hidden control sheet depending on what radio button a user chooses. '===================================================================== Option Explicit Private Sub cmdCancel_Click() Unload Me ' this unload the form and closes it ' otherwise it can still be active but hidden from the user. End End Sub '----------------------------------------------------- Private Sub cmdOk_Click() If Me.rbBlueGates.Value = True Then Sheet5.Range("xlnrVersionGates").Value = "Blue Gates Included" Unload Me Call RunChangeViewOnly ElseIf Me.obNormalGates.Value = True Then Sheet5.Range("xlnrVersionGates").Value = "Normal Gates Only" Unload Me Call RunChangeViewOnly End If End Sub '----------------------------------------------------- Private Sub obBlueGates_Click() Me.rbBlueGates.Value = True Me.rbNormalGates.Value = False End Sub '----------------------------------------------------- Private Sub obNormalGates_Click() Me.rbNormalGates.Value = True Me.rbBlueGates.Value = False End Sub '====================================================== -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Friday, 19 March 2010 3:06 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Excel - HOW TO SEE MY MODULES COLLECTION That did it. Thanks. So, I am playing this game, Ikariam. The alliance I am in is doing a "practice war". My General has created a spreadsheet with the enemy cities in a sheet, and a "map" sheet displaying the islands in green, water in blue and the enemy islands in red. I have added a new sheet with alliance cities, same info as enemy. I wrote a class to load the enemy and alliance city lists into clsCity instances and store those instances in clsCities instances - one for the enemy and one for the alliance. Now I can: Load the alliance city list and iterate through it setting the island color to something (yellow), or orange if it is already red (enemy) but there is an alliance city on the same island. Provide a list of alliance islands close to the enemy city clicked on or vice versa. At this point I am very new to doing stuff in Excel so my visual is just a message box. A form would be a good thing but I don't know how to create one, how to open it, push text to controls on it etc. But just what I can do is good. Ikariam has the ability to use this scripting language called GreaseMonkey. I have never even looked at it but it would be really cool to manage to read each island, what it produces, cities on it etc and populate a spreadsheet with that stuff. Just dreaming of course. John W. Colby www.ColbyConsulting.com Collins, Darryl wrote: > > Hi John, > > Make sure you have the properties window visible (View > Properties or > F4). Then in the project explorer window click on the class "Class1" > under the Class Module Folder. In the properties window under the > "Alphabetic" tab the top option will be "(Name)". You can change the > module name here from "Class1" to "Whateveryouwant". There are some > restrictions as in Access on what you can call a module, but that > should get you started. > > Cheers > Darryl. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com "This e-mail and any attachments to it (the "Communication") is, unless otherwise stated, confidential, may contain copyright material and is for the use only of the intended recipient. If you receive the Communication in error, please notify the sender immediately by return e-mail, delete the Communication and the return e-mail, and do not read, copy, retransmit or otherwise deal with it. Any views expressed in the Communication are those of the individual sender only, unless expressly stated to be those of Australia and New Zealand Banking Group Limited ABN 11 005 357 522, or any of its related entities including ANZ National Bank Limited (together "ANZ"). ANZ does not accept liability in connection with the integrity of or errors in the Communication, computer virus, data corruption, interference or delay arising from or in respect of the Communication."