LHSP‡ 7example <1to10> by <1to10> by <1to10> 1to101to101to10dimensionsymbol!second example of 3D measurementstest˙|Sub Main SendKeys ListVar1 ' Step 1 – display the first number ' Step 2 - Display unit of measure SendKeys Mid(ListVar4, 1, InStr(ListVar4, "\")-1) SendKeys " x " ' Steps 3 and 6, send the "by" symbol SendKeys ListVar2 ' Step 4 – display the second number ' Step 5 - Display unit of measure SendKeys Mid(ListVar4, 1, InStr(ListVar4, "\")-1) SendKeys " x " ' Steps 3 and 6, send the "by" symbol SendKeys ListVar3 ' Step 7 – display the third number ' Step 8 - Display unit of measure SendKeys Mid(ListVar4, 1, InStr(ListVar4, "\")-1) SendKeys " " ' Step 9 - Display a trailing space End Sub example save for signaturereplacing invalid characterstest˙”Sub Main ' macro to get me home 10 minutes earlier each day SendKeys "^{Home}" ' 1. ctrl+home move to top of document Wait .5 SendKeys "%e" ' 2. alt+e select Edit menu Wait .5 MenuPick "Find" ' 3. select the “find” ' Advanced–Steps 2 & 3 can be done via a SendKeys "^f" ' Wait 5 Wait .5 ' 4. Wait a while ' 5. try to find "RE:" then destroy the "Find" window SendKeys "RE:{Enter}{Esc}" ' Wait 5 Wait .5 ' 6. Wait a while ' 7. move right two then copy the rest of the line SendKeys "{Right 2}+{End}^c" Wait .5 ' 8. alt+f for File, then a for Save As SendKeys "%fa" ' 8. alt+f for File, then a for Save As Wait .5 ' SendKeys "C:\My Documents\ReadyForSignature\" ' Alternate of SendKeys "C:\Temp\" Wait .5 '----------- Show Replace function ----------- Fname$ = Clipboard ' put clipboard contents into ' the strin Fname$ ' replace periods with underline Fname$ = Replace (Fname$, ".", "_") ' replace slashes with underline Fname$ = Replace (Fname$, "/", "_") ' modify step 10 SendKeys Fname$ ' 10. updated file name ' -------- end of String Operations Changes ----- Wait .5 HeardWord "click", "Save" ' 11. save the file End Sub 0sample <1to10> by <1to10> by <1to10> 1to101to101to10 dimension(first example of 3-D measurement commandtest˙}Sub Main SendKeys ListVar1 ' Step 1 – display the first number ' Step 2 - Display unit of measure If ListVar4 = "inches" Then SendKeys "in." If ListVar4 = "feet" Then SendKeys "'" If ListVar4 = "millimeters" Then SendKeys "mm" If ListVar4 = "centimeters" Then SendKeys "cm" If ListVar4 = "meters" Then SendKeys "m" SendKeys " x " ' Steps 3 and 6, send the "by" symbol SendKeys ListVar2 ' Step 4 – display the second number ' Step 5 - Display unit of measure If ListVar4 = "inches" Then SendKeys "in." If ListVar4 = "feet" Then SendKeys "'" If ListVar4 = "millimeters" Then SendKeys "mm" If ListVar4 = "centimeters" Then SendKeys "cm" If ListVar4 = "meters" Then SendKeys "m" SendKeys " x " ' Steps 3 and 6, send the "by" symbol SendKeys ListVar3 ' Step 7 – display the third number ' Step 8 - Display unit of measure If ListVar4 = "inches" Then SendKeys "in." If ListVar4 = "feet" Then SendKeys "'" If ListVar4 = "millimeters" Then SendKeys "mm" If ListVar4 = "centimeters" Then SendKeys "cm" If ListVar4 = "meters" Then SendKeys "m" SendKeys " " ' Step 9 - Display a trailing space End Sub sample choose formatdialog command for formattingtest˙‘Sub Main Begin Dialog UserDialog 400,203 ' %GRID:10,7,1,1 TextBox 30,14,330,63,.TextBox1,1 OptionGroup .Group1 OptionButton 40,91,90,14,"bold",.OptionButton1 OptionButton 40,119,90,14,"underline",.OptionButton2 OptionButton 40,147,90,14,"italics",.OptionButton3 OKButton 80,175,90,21 CancelButton 230,175,90,21 End Dialog Dim dlg As UserDialog If Dialog(dlg) = -1 Then Select Case dlg.Group1 Case 0 ' bold s="^b" Case 1 ' underline s="^u" Case 2 ' italics s="^i" End Select ' Wait .5 ' let focus return SendKeys s SendKeys dlg.TextBox1 SendKeys s Else End If End Sub sample control panel applet shell commandtest˙¨Sub Main ' There are many of these applets. ' Some have different values in different versions of Windows. ' This sample is based on Windows-XP Professional ' The second argument to the Shell command, "vbMaximizedFocus", causes ' windows to open. If not present, then some of these Control ' Panel applets open minimized. Shell("control " & Mid(ListVar1,1,InStr(ListVar1,"\")-1),vbMaximizedFocus) End Sub !sample control panel screen saveropen the screen saver applettest0Sub Main Shell "control desk.cpl,,1" End Sub +sample document name_of_document_templateopen a Word templatetestWINWORDMicrosoft Word for WindowsMicrosoft Corporation˙D'#Reference {00020905-0000-0000-C000-000000000046}#8.1#0#c:\Program Files\Microsoft Office\Office\MSWORD9.OLB#Microsoft Word 9.0 Object Library Sub Main ' ' Start with the default User Template directory for Word Filename$ = Options.DefaultFilePath(wdUserTemplatesPath) ' ' append the "\", the file name, and the ".dot" suffix Filename$ = Filename$ & "\" & ListVar1 & ".dot" ' ' prepare for the case where the template does not exist On Error GoTo NoTemplate ' ' open a new instance of the template using the Word ' VBA statement for opening a document template. ' Note the continuation of the statement (“_”) Documents.Add Template:=Filename$, NewTemplate:=False, _ DocumentType:=0 Exit Sub ' NoTemplate: ' Come here if no template exists ErrMess$ = "Template not found: " & ListVar1 MsgBox ErrMess$ End Sub sample email subjectsshow subject lines of emailtest˙/Sub Main Dim myOlApp As Object Dim intMsgCount As Integer, intMyFoldersCount As Integer Dim myFolder As Variant Dim x As Integer Set myOlApp = CreateObject("Outlook.Application") Set myNameSpace = myOlApp.GetNamespace("MAPI") Set myFolder= myNameSpace.GetDefaultFolder(6) ' intMsgCount = myFolder.Items.Count ' Loop through each message and display the ' unread messages with MsgBox For x = 1 To intMsgCount myUnread = myFolder.Items(x).UnRead If myUnread = True Then MsgBox myFolder.Items(x) End If Next x End Sub sample insert  insertableinsert a block of texttestWINWORDMicrosoft Word for WindowsMicrosoft Corporation˙$'#Reference {00020905-0000-0000-C000-000000000046}#8.1#0#c:\Program Files\Microsoft Office\Office\MSWORD9.OLB#Microsoft Word 9.0 Object Library Sub Main ' Create the filename. ' Start with the default file path from Word. If you wish a ' different folder for these files, replace the following ' statement with one of the form ' Filename$ = "your folder name" Filename$ = Options.DefaultFilePath(wdDocumentsPath) ' ' Append a trailing backslash, then the insertable file name, ' then ".doc" to complete the file name. Filename$ = Filename$ & "\" & ListVar1 & ".doc" ' ' The following three lines are from VBA and ' do the file insertion. Selection.InsertFile FileName:= Filename$, Range:="", _ ConfirmConversions:=False, Link:=False, _ Attachment:=False End Sub sample macro oneexecutes Word "macro1" macrotestWINWORDMicrosoft Word for WindowsMicrosoft CorporationÄ'#Reference {00020905-0000-0000-C000-000000000046}#8.1#0#c:\Program Files\Microsoft Office\Office\MSWORD9.OLB#Microsoft Word 9.0 Object Library Sub Main Word.Application.Run "macro1" End Sub sample mole removal risks&insert the standard mole removal riskstest Fthere is a risk of infection if the wound is not properly cared for...sample mole removal surgerya really dumb command for metestxSub Main SendKeys "The mole was excised to a depth of " SendKeys "2mm " SendKeys "below the skin surface." End Sub "sample mole removal surgery <1to5>1to5a really dumb command for metest‚Sub Main SendKeys "The mole was excised to a depth of " SendKeys ListVar1 & "mm " SendKeys "below the skin surface." End Sub sample mole risk insertanother silly example for metest˙{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\fnil\fcharset0 MS Sans Serif;}} {\colortbl ;\red0\green0\blue0;} \viewkind4\uc1\pard\cf1\f0\fs24 there is a risk of infection if the wound is not properly cared for...\cf0\f1\fs17 }Fthere is a risk of infection if the wound is not properly cared for...sample open sales taxcalculate sales tax of 8.1%testC:\WINDOWS\Calc.exe C:\WINDOWS\Č 0.0818sample phone number  phonelistdisplay phone numbertestDSub Main MsgBox Mid(ListVar1, 1, InStr(ListVar1, "\")-1) End Sub sample save for signature!save a file based on RE: contentstest˙JSub Main ' macro to get me home 10 minutes earlier each day SendKeys "^{Home}" ' 1. ctrl+home move to top of document Wait .5 SendKeys "%e" ' 2. alt+e select Edit menu Wait .5 MenuPick "Find" ' 3. select the “find” ' Advanced–Steps 2 & 3 can be done via a SendKeys "^f" ' Wait 5 Wait .5 ' 4. Wait a while ' 5. try to find "RE:" then destroy the "Find" window SendKeys "RE:{Enter}{Esc}" ' Wait 5 Wait .5 ' 6. Wait a while ' 7. move right two then copy the rest of the line SendKeys "{Right 2}+{End}^c" Wait .5 ' 8. alt+f for File, then a for Save As SendKeys "%fa" ' 8. alt+f for File, then a for Save As Wait .5 ' SendKeys "C:\My Documents\ReadyForSignature\" ' Alternate of SendKeys "C:\Temp\" Wait .5 SendKeys "^v" ' 10. paste the file name Wait .5 HeardWord "click", "Save" ' 11. save the file End Sub sample show window titledisplay title of current windowtest˙ ' declare three Windows functions Declare Function GetForegroundWindow& Lib "user32" () Declare Function GetWindowTextLengthA& Lib "user32" _ (ByVal hwnd&) Declare Sub GetWindowTextA Lib "user32" _ (ByVal hwnd&, ByVal lpsz$, ByVal cbMax&) ' ' use Windows functions to obtain a string with the ' title of the current window. The string is returned ' as the value of the ActiveWindowTitle function. Function ActiveWindowTitle$() ActiveWindow = GetForegroundWindow() TitleLen = GetWindowTextLengthA(ActiveWindow) Title$ = Space$(TitleLen) GetWindowTextA ActiveWindow,Title$,TitleLen+1 ActiveWindowTitle$ = Title$ End Function ' Use the window title – in this case, display it. ' More commonly it would be compared. Sub Main MsgBox ActiveWindowTitle$ End Sub sample two boxes-sample using Dialog Editor for two text boxestest˙řSub Main Begin Dialog UserDialog 400,203,"Two Text Boxes" ' %GRID:10,7,1,1 Text 10,7,90,14,"Short Text",.Text1 TextBox 120,7,260,21,.TextBox1 Text 20,49,90,14,"Long Text",.Text2 TextBox 130,49,250,84,.TextBox2,1 OKButton 130,161,90,21 End Dialog Dim dlg As UserDialog Dialog dlg SendKeys dlg.TextBox1 SendKeys "~~~" ' tilde “~” Is equivalent To “{Enter}” Clipboard dlg.TextBox2 ' TextBox2 Text To Clipboard SendKeys "^v" ' ctrl+v Is To paste the Text End Sub sample what time is it give timetest˙™Sub Main ' 1. Display the hour using 12-hour clock numbering AdjustHour = Hour(Now) If AdjustHour = 0 Then AdjustHour = 12 If AdjustHour > 12 Then AdjustHour = AdjustHour - 12 ' 2. Display a “:” to separate the hour and minute ' 3. Display the minute as a two-digit value If Minute(Now) < 10 Then MsgBox AdjustHour & ":0" & Minute(Now) Else MsgBox AdjustHour & ":" & Minute(Now) End If End Sub sample yesterdayprint the date of yesterdaytestôSub Main Dim Yesterday As Date Yesterday = Now-1 ' We want only one value for "yesterday" SendKeys WeekdayName(Weekday(Yesterday)) & " " SendKeys MonthName(Month(Yesterday)) & " " SendKeys Day(Yesterday) & " " & Year(Yesterday) End Sub 1to10 123456789101to512345appletaccess.cpl\accessibilityappwiz.cpl\add remove programs fonts\fontsmmsys.cpl,,2\multimedia audio mmsys.cpl,,4\multimedia hardwaremmsys.cpl,,1\multimedia soundsprinters\printerstimedate.cpl\date time insertableBugsTaste Underweightdimensionsymbol'\feetcm\centimetersm\metersmm\millimeters in.\inches dimensioninchesfeet millimeters centimetersmeters phonelist(654)765-4321\Joe the neighbor01-999-5432-54321-32\E.T.652-432-4321\company president876-5432\office 987-6543\homename_of_document_templatepay off customer follow upletter