Board index » Visual Studio » Newbie: Works when stepped through, but not when run?
|
TXDude
|
Newbie: Works when stepped through, but not when run?
Visual Studio204
I have a simple code to rename the files in a specific folder. When I stepped through it to check it, it worked fine. I'm sure I even ran the exe after creating it just to make sure. But that was last week! Today, if I run the exe, it tells me it's done, but it didn't work. If I step through it, everything works fine! Can someone tell me what's going on, and how to correct it, please? Ed Private Sub Command1_Click() Dim objFSO As Object Dim objFolder As Object Dim objFile As Object Set objFSO = CreateObject("Scripting.FileSystemObject") On Error Resume Next Set objFolder = objFSO.GetFolder _ ("C:\Documents and Settings\emillis\Desktop\Files\") If Not objFolder Is Nothing Then On Error GoTo 0 For Each objFile In objFolder.Files With objFile .Name = .Name & ".doc" End With Next End If MsgBox "I'm done!" End Sub - |
