VERSION 5.00 Begin VB.Form Form1 Caption = "Form1" ClientHeight = 3195 ClientLeft = 60 ClientTop = 345 ClientWidth = 4680 LinkTopic = "Form1" ScaleHeight = 3195 ScaleWidth = 4680 StartUpPosition = 3 'Windows Default Begin VB.CommandButton Command1 Caption = "Command1" Height = 495 Left = 360 TabIndex = 0 Top = 240 Width = 1215 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub Command1_Click() 'Return first *.TXT file with a set hidden attribute. MyFile = Dir("*.*", vbNormal) Dim MyString, FirstWord, LastWord, MidWords MyString = "Mid Function Demo" ' Create text string. FirstWord = Mid(MyString, 1, 3) ' Returns "Mid". LastWord = Mid(MyString, 14, 4) ' Returns "Demo". MidWords = Mid(MyString, 5) ' Returns "Function Demo". ' Display the names in C:\ that represent directories. MyPath = "e:\rename\" ' Set the path. MyName = Dir(MyPath, vbNormal) ' Retrieve the first entry. Do While MyName <> "" ' Start the loop. ' Ignore the current directory and the encompassing directory. 'If MyName <> "." And MyName <> ".." Then ' Use bitwise comparison to make sure MyName is a directory. 'If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then Debug.Print MyName ' Display entry only if it ' End If ' it represents a directory. 'End If If InStr(MyName, "(") > 0 Then strtemp = Mid(MyName, 1, InStr(MyName, "(") - 1) Debug.Print strtemp FileCopy MyName, "thumb" & strtemp & ".jpg" strtemp = "" End If MyName = Dir ' Get next entry. Loop End Sub