The following example is from the MicroSoft TechNet CD-PSS ID Number: Q75639 Step 1: Create a file in your root directory named mytest.ini: (c:\mytest.ini) paste the following text to the file: [ProgNames] WordProcessor=NOTEPAD.EXE Calculator=CALC.EXE Step 2: Start a new VisualBasic 1, 2 or 3 Project and Paste the following text into (General)(declarations); then run (F5) and click the form: Declare Function GetPrivateProfileString% Lib "kernel" (ByVal lpAppName$, ByVal lpKeyName$, ByVal lpDefault$, ByVal lpReturnString$, ByVal nSize%, ByVal lpFileName$) Sub Form_Click () '* If an error occurs during SHELL statement then handle the '* error. On Error GoTo FileError Dim lpAppName$, lpKeyName$, lpDefault$, lpReturnString$, lpFileName$ Dim Size%, Valid%, Prog$, Succ% '* Compare these to the mytest.ini file that you created in step 1 '* above. lpAppName$ = "ProgNames" lpKeyName$ = "Calculator" lpDefault$ = "" lpReturnString$ = Space$(128) Size% = Len(lpReturnString$) '* This is the path and name the mytest.ini file. lpFileName$ = "c:\mytest.ini" '* This call will cause the value of Calculator (that is, '* CALC.EXE) to be placed into lpReturnString$. The '* return value (assigned to Valid%) represents the number of '* characters read into lpReturnString$. Note that the '* following assignment must be placed on one line. Valid% = GetPrivateProfileString(lpAppName$, lpKeyName$, lpDefault$, lpReturnString$, Size%, lpFileName$) '* Discard the trailing spaces and null character. Prog$ = Left$(lpReturnString$, Valid%) '* Try to run CALC.EXE. If unable to run, FileError is called. Succ% = Shell(Prog$, 1) Exit Sub FileError: MsgBox "Can't find file " & Prog$, 16, "Error lpReturnString" Resume Next End Sub