Hi all,
I have written the script below. The goal is open each .xls file in a folder, then save it to another folder as a .txt file. It works perfectly on my Windows 7 (64 bit) laptop, but I tried using it on an XP computer today, and it's not working. Both machines are running Excel 2007. The script doesn't error out, it just acts as if there are no Excel files in the Process folder (which there are). The problem is not the folder path (that problem was fixed first). I am a total amateur at this, so forgive my ignorance... any help would be greatly appreciated!
Thanks,
Monica
Here's the script:
Sub Digest()
Application.DisplayAlerts = False
Dim wbOpen As Workbook
Dim wbNew As Workbook
Const strPath As String = "C:\Documents and Settings\ctr_mflint\Desktop\2Process\"
Dim strExtension As String
Dim strName As String
ChDir strPath
strExtension = Dir("*.xl*")
Do While strExtension <> ""
Set wbOpen = Workbooks.Open(strPath & strExtension)
With wbOpen
strName = Replace(.Name, ".xls", ".txt")
ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\ctr_mflint\Desktop\3Ready\" & strName, FileFormat:=xlText, AddtoMRU:=False
ActiveWorkbook.Close
End With
strExtension = Dir
Loop
Application.DisplayAlerts = True
On Error GoTo 0
End Sub
Bookmarks