12114:demo

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
12114:demo [2024/04/15 04:00 UTC] mwolfe12114:demo [2024/04/15 04:54 UTC] – [Edit the Code in myToolWindow.twin] mwolfe
Line 6: Line 6:
   - Extract from Zip folder   - Extract from Zip folder
   - Open twinBASIC > **Sample 4**   - Open twinBASIC > **Sample 4**
-  - Enter name: ''Demo 2024''+  - Enter Project Name: ''Demo2024'' (//Do not put spaces in the name//)
   - Save as: ''%tmp%\Demo2024\Demo2024.twinproj''   - Save as: ''%tmp%\Demo2024\Demo2024.twinproj''
 +    - Navigate to: ''%tmp%''
 +    - Create folder named: ''Demo2024''
 +    - Filename: ''Demo2024.twinproj''
 +
 +===== Customize the Addin Name and Description =====
 +Next, let's customize the friendly name and description of our addin.  This is the info that appears in the VBA Add-in Manager dialog box.
 +  - Go to **dllRegistration.twin** > **DllRegisterServer**
 +  - In the "FriendlyName" line, replace //AddinProjectName// with ''"DevCon 2024 Demo"''
 +  - In the "Description" line, replace //AddinProjectName// with ''"Create a strongly-typed collection class from an existing VBA class object."''
 +  - Save the project
 +  - Build the project
 +  - Launch ''M:\Repos\NLS\DevCon2024\DevCon2024.accdb''
 +  - Switch to VBA: <key>Ctrl</key> + <key>G</key>
 +  - Dock the add-in window
 +  - Go to "Add-Ins" > "Toggle myToolWindow Visibility"
 +  - Go to "Add-Ins" > "Add-in Manager"
 +    * Point out the "DevCon 2024 Demo" item with description below
 +  - Close "Add-In Manager" window 
  
 ===== Create the Tool Window Controls ===== ===== Create the Tool Window Controls =====
 +Next, we're going to customize the controls that appear on the tool window.  I'll explain what these controls will be used for in a minute.  For now, all you need to know is that we are adding two text boxes, a command button, and a label to hold a version number.
  
   - Open myToolWindow.tbcontrol   - Open myToolWindow.tbcontrol
   - Select all controls and delete them   - Select all controls and delete them
 +  - Click DIAGNOSTICS error to go to myToolWindow.twin and **delete all dead code**
   - Select form and set the following properties:   - Select form and set the following properties:
     * Height: 1700     * Height: 1700
Line 42: Line 62:
     * Top: 1050     * Top: 1050
     * Width: 2250        * Width: 2250   
 +  - Create a version label
 +    * Caption: Version {hhmm}  
  
 ===== Edit the Code in myToolWindow.twin ===== ===== Edit the Code in myToolWindow.twin =====
Line 55: Line 77:
 </code> </code>
  
-===== Build and Test the Addin on Same Machine ===== +  - Make sure Access is closed then **Build** the tB project 
-The following instructions assume a machine with 32-bit Office (e.g., mjw20):+  - Reopen Access and switch to VBA 
 +  - Enter sample text ''oVehicle'' for object class name and ''collVehicles'' for collection class name then click [Create Collection Class] 
 +  
  
-  - Ensure "**win32**" is selected in dropdown 
-  - **File** > **Build** 
-    * Creates and registers this file: ''M:\Repos\NLS\DevCon2024\Build\DevCon2024_win32.dll'' 
-    * As part of registration, the following registry key and values are created: 
-      * ''HKEY_CURRENT_USER\SOFTWARE\Microsoft\VBA\VBE\6.0\Addins\DevCon2024.myAddIn\'' 
-        * Description: "DevCon2024" 
-        * FriendlyName: "DevCon2024" 
-        * LoadBehavior: 3  ([[https://learn.microsoft.com/en-us/visualstudio/vsto/registry-entries-for-vsto-add-ins?view=vs-2022#LoadBehavior|3 => Loaded/Load at startup]]) 
-      * ''HKEY_CLASSES_ROOT\DevCon2024.myAddIn\CLSID'' 
-        * (Default): ''{9B80DA6E-8B20-4D53-AE54-430ACFAE987B}''  //(this matches the ''[ClassID()]'' attribute value above the myAddIn class in myAddIn.twin)//\\ {{:gb:fb:pasted:20240410-034733.png}} 
-      * ''HKEY_CLASSES_ROOT\DevCon2024.myToolWindow\CLSID'' 
-        * (Default): ''{D531346A-90B8-470D-AA33-FB009F19CEFD}''  //(this matches the ''[ClassID()]'' attribute value above the myToolWindow class in myToolWindow.twin)//\\ {{:gb:fb:pasted:20240410-034605.png}} 
-      * ''HKEY_CLASSES_ROOT\CLSID\{9B80DA6E-8B20-4D53-AE54-430ACFAE987B}'' 
-        * (Default): ''myAddIn'' 
-        * ''\InProcServer32'' 
-          * (Default): ''M:\Repos\NLS\DevCon2024\Build\DevCon2024_win64.dll''  //(<wrap important>NOTE</wrap>: The presence of win64.dll here is likely a result of running the win64 build as shown in the next section)// 
-          * ThreadingModel: Both 
-        * ''\ProgID'' 
-          * (Default): ''DevCon2024.myAddIn''\\ {{:gb:fb:pasted:20240410-035346.png}} 
-    * DEBUG CONSOLE should show this:  
-      * [LINKER] SUCCESS created output file 'M:\Repos\NLS\DevCon2024\Build\DevCon2024_win32.dll' 
-      * [LINKER]    -> Open Folder //(NOTE: this is a clickable link)// 
-      * [REGISTER] type-library registration completed. DllRegisterServer() returned OK 
-  - Open Excel or Access 
-  - Press [Alt] + [F11] to go to VBA IDE 
-  - Tool window will likely be floating; click and drag to dock it somewhere:\\ {{:gb:fb:pasted:20240410-032600.png}} 
-  - Enter ''Obj Name'' in the first text box, ''Coll Name'' in the second text box, then click [Create Collection Class]\\ {{:gb:fb:pasted:20240410-032714.png}} 
  
 ===== Build and Test the Addin on a Different Machine and Bitness ===== ===== Build and Test the Addin on a Different Machine and Bitness =====
  • 12114/demo.txt
  • Last modified: 2024/04/15 19:11 UTC
  • by mike