Results 1 to 2 of 2

Script not identifying excel files?

Threaded View

  1. #1
    Registered User
    Join Date
    10-22-2010
    Location
    Washington, DC
    MS-Off Ver
    Excel 2007
    Posts
    1

    Script not identifying excel files?

    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
    Last edited by Leith Ross; 10-22-2010 at 02:35 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1