Public Sub VBLinkerSample() 'See also: ' VBLinker Function ' VBUtilitiesSample Subroutine Const strFn = "VBLinkerSample" Dim strSeparator As String strSeparator = InputBox("String separator for include function/sub names and input file list: ({Esc} cancels.)", strFn, " ") If Len(strSeparator) = 0 Then Exit Sub Dim strIncludeFileOrSubPattern As String strIncludeFileOrSubPattern = "*Test" & strSeparator & "*Sample" & strSeparator & "*Benchmark" & strSeparator & "*Verify" strIncludeFileOrSubPattern = InputBox("Include Functions, Subs, and Modules matching these patterns: (Multiple names (separated by the separator) allowed; {Esc} cancels.)", strFn, strIncludeFileOrSubPattern) If Len(strIncludeFileOrSubPattern) = 0 Then Exit Sub Dim strFromFilesList As String strFromFilesList = "\Entisoft\Tools\*.Cls" strFromFilesList = InputBox("Read Visual Basic 4.0 Modules: (Multiple file names (separated by the separator) and wildcards allowed; {Esc} cancels.)", strFn, strFromFilesList) If Len(strFromFilesList) = 0 Then Exit Sub Dim strToFileOrDirectory As String strToFileOrDirectory = GetTempFileName(Null, strFn) Kill strToFileOrDirectory strToFileOrDirectory = InputBox("Write VBA Module: (ANY FILE WITH THIS NAME WILL BE OVERWRITTEN; {Esc} cancels.)", strFn, strToFileOrDirectory) If Len(strToFileOrDirectory) = 0 Then Exit Sub Dim intWriteAsFile As Integer Select Case MsgBox("Write output as one file only? Choose No to write one output file per input file in the specified output directory.", vbQuestion + vbYesNoCancel + vbDefaultButton1, strFn) Case vbYes intWriteAsFile = True Case vbNo intWriteAsFile = False Case vbCancel Exit Sub Case Else Stop End Select If Not intWriteAsFile Then MakeDirectory strToFileOrDirectory Dim strModuleHeader As String strModuleHeader = "Option Explicit" strModuleHeader = InputBox("Module header?", strFn, strModuleHeader) Dim strIgnoreLinesLike As String strIgnoreLinesLike = "Option Explicit" strIgnoreLinesLike = InputBox("Ignore lines matching LIKE pattern? ({Esc} means do not ignore any lines.)", strFn, strIgnoreLinesLike) Dim intStripComments As Integer Select Case MsgBox("Remove Comments from the Visual Basic Code?", vbQuestion + vbYesNoCancel + vbDefaultButton2, strFn) Case vbYes intStripComments = True Case vbNo intStripComments = False Case vbCancel Exit Sub Case Else Stop End Select Dim intTopLevelOnly As Integer Select Case MsgBox("Write top-level functions/modules only (those whose name matches the include file or sub pattern)?", vbQuestion + vbYesNoCancel + vbDefaultButton2, strFn) Case vbYes intTopLevelOnly = True Case vbNo intTopLevelOnly = False Case vbCancel Exit Sub Case Else Stop End Select Dim intBottomLevelOnly As Integer Select Case MsgBox("Write bottom-level functions/modules only (those whose name matches the include file or sub pattern)?", vbQuestion + vbYesNoCancel + vbDefaultButton2, strFn) Case vbYes intBottomLevelOnly = True Case vbNo intBottomLevelOnly = False Case vbCancel Exit Sub Case Else Stop End Select Dim intSuppressAttributes As Integer Select Case MsgBox("Suppress Attribute statements?", vbQuestion + vbYesNoCancel + vbDefaultButton2, strFn) Case vbYes intSuppressAttributes = True Case vbNo intSuppressAttributes = False Case vbCancel Exit Sub Case Else Stop End Select Dim strVBAReservedWords As String strVBAReservedWords = InputBox("VBA Reserved Words: ({Esc} means no reserved words!)", strFn, VBAReservedWords) MsgBox "Return = " & VBLinker(vIncludeFileOrSubPattern:=strIncludeFileOrSubPattern, vFromFilesList:=strFromFilesList, vSeparator:=strSeparator, vToFileOrDirectory:=strToFileOrDirectory, vWriteAsFile:=intWriteAsFile, vModuleHeader:=strModuleHeader, vIgnoreLinesLike:=strIgnoreLinesLike, vStripComments:=intStripComments, vTopLevelOnly:=intTopLevelOnly, vBottomLevelOnly:=intBottomLevelOnly, vSuppressAttributes:=intSuppressAttributes, vVBAReservedWords:=strVBAReservedWords) & " (True means success; False means failure.)", vbInformation, strFn End Sub
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.