Home  |   French  |   About  |   Search  | mvps.org  

What's New
Table Of Contents
Credits
Netiquette
10 Commandments 
Bugs
Tables
Queries
Forms
Reports
Modules
APIs
Strings
Date/Time
General
Downloads
Resources
Search
Feedback
mvps.org

In Memoriam

Terms of Use


VB Petition

Modules: CodeWriter 2.0

Author(s)
Arvin Meyer

CodeWriter is a utility designed to reduce the repetitive tasks of filling in the initial code title block and comments, and to ease the effort in writing message box code. It was written in VB5, and can provide generic code for Access Basic (with a minor change after pasting the code), VB 4,5, & 6, and VBA.

    Download CodeWriter 2.0

Note: The CodeWriter uses tabctl32.ocx; version: 5.01.4319 .

A sample of the Generate Code to Clipboard output looks like:

Function TestFunction(var1 As Integer, Optional str1 As String) As String
'--------------------------------------------------------------------
' Name:	TestFunction
' Purpose:	
'
' Inputs:	
'
' Returns:	
'
' Author:	Arvin Meyer
' Date:	February 15, 1999
' Comment:	This is a test comment
'
'--------------------------------------------------------------------
On Error GoTo Err_TestFunction


Exit_TestFunction:
	Exit Function

Err_TestFunction:
	Select Case Err

	Case 0


	Case Else
		MsgBox Err.Description
		Resume Exit_TestFunction
	End Select

End Function
--------------------
Notice how it correctly adds Function/Sub names to the procedures, and carries the name through the error handling and exit labels. A combo box allows a choice of data or object types, and other types may be used by typing in the box. There is error handling to make sure the procedure name will abide by VB/VBA naming rules. If you pass variables to the procedure and set the first to be Optional, the second will automatically become Optional.

The code delineator can be chosen from 4 different symbols (* - . =). You can use as many or as few of the features as you wish. 

Error handling code is optionally added by checking the appropriate check box.. In Access 2.0 the error code line "Err.Description" should be changed to "Error$" (without the quotes). Case 0 in the error handling code should be changed to the error number if need be, or can be deleted if not used.

The Clear button will clear all controls to ready the output for the first/next use.

After clicking the "Generate Code to Clipboard" button, the app minimizes to the taskbar awaiting its next use.

A sample of the Generate MsgBox to Clipboard output looks like:

--------
MsgBox "This is line one" & vbCrLf & "This is line two" & vbCrLf & "This is line three", 323, "Application Error"
--------

Or, when using a variable:

--------
Dim RetVar As Integer ' MsgBox response
RetVar = MsgBox("This is line one" & vbCrLf & "This is line two" & vbCrLf & "This is line three", 67, "Application Error")
--------

If no Title is used, the default is "Access Error" (I am an Access programmer <g>). You may add up to 3 separate line is the MsgBox. You may choose which Icon to use, or not use any, you may choose which button style you want, and which button will be the default (Btn1 is the default). And you may Preview what the MsgBox will look like.

This application is copyrighted and distributed as freeware. You may not distribute it as part of any sold shareware package, without my prior consent. In future releases (which will probably be shareware) I plan to add a tab to generically write code for DAO, ADO, and/or RDO RecordSets. Any suggestions, comments, or bugs, should be reported to me at: arvinm@datastrat.com


© 1998-2010, Dev Ashish & Arvin Meyer, All rights reserved. Optimized for Microsoft Internet Explorer