Results 1 to 5 of 5

Thread: [RESOLVED] saveAs Export not working

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    144

    Resolved [RESOLVED] saveAs Export not working

    objWorkbook.SaveAs FileName:="C:\Test.txt", FileFormat:=xlText

    This is not working for me.
    I get SaveAs method of workbook failed (1004)
    I changed x|Text to one of many wdformats they fail too. ex(wdFormatDOSTextLineBreaks )

    i need to export the spread sheet after making changes to a tab delimited file.

    thanks.

  2. #2
    Frenzied Member zaza's Avatar
    Join Date
    Apr 2001
    Location
    Borneo Rainforest Habits: Scratching
    Posts
    1,486

    Re: saveAs Export not working

    Can you save it in any format at all using this code? Even a format you aren't interested it? Is there some problem with using the filename you have chosen?

    zaza

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    144

    Re: saveAs Export not working

    no formats work. filename is temp.txt. if i leave off FileFormat:=xlText then is saves it with the new file name only not readable in notepad obviously.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    144

    Re: saveAs Export not working

    I'm gonna mark this resolved. looks like i have to use this:
    objWorkbook.SaveAs FileName:="C:\Test.txt", FileFormat:=3

    i was not setting the constants. thanks for your help. any further info on this will still be helpful.

  5. #5
    Frenzied Member
    Join Date
    May 2004
    Location
    Carlisle, PA
    Posts
    1,045

    Re: [RESOLVED] saveAs Export not working

    Hmmmm ... typical MegaShaft SNAFU. Here are some of the significant enumerations from '2003 xlFileFormat Class Members in the Object Browser(Hit <F2>). Of course, "3" is missing!
    Code:
    Debug.Print "xlSYLK", xlSYLK
    Debug.Print "xlWKS", xlWKS
    Debug.Print "xlWK1", xlWK1
    Debug.Print "xlCSV", xlCSV
    Debug.Print "xlDBF2", xlDBF2
    Debug.Print "xlText", xlText
    Debug.Print "xlTextMac", xlTextMac
    Debug.Print "xlTextMSDOS", xlTextMSDOS
    Debug.Print "xlTextWindows", xlTextWindows
    Debug.Print "xlTextPrinter", xlTextPrinter
    Debug.Print "xlUnicodeText", xlUnicodeText
    Debug.Print "xlAddIn", xlAddIn
    Debug.Print "xlCSVMac", xlCSVMac
    Debug.Print "xlCSVMSDOS", xlCSVMSDOS
    Debug.Print "xlCSVWindows", xlCSVWindows
    Produces the following table:
    Code:
    xlSYLK         2 
    xlWKS          4 
    xlWK1          5 
    xlCSV          6 
    xlDBF2         7 
    xlText        -4158 
    xlTextMac      19 
    xlTextMSDOS    21 
    xlTextWindows  20 
    xlTextPrinter  36 
    xlUnicodeText  42 
    xlAddIn        18 
    xlCSVMac       22 
    xlCSVMSDOS     24 
    xlCSVWindows   23
    How did you find that "3" works?
    Blessings in abundance,
    All the Best,
    & ENJOY!

    Art . . . . Carlisle, PA . . USA

Posting Permissions

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



Click Here to Expand Forum to Full Width