+ Reply to Thread
Results 1 to 10 of 10

file save as tab delimited change to direct file save

  1. #1
    Registered User
    Join Date
    06-10-2004
    Posts
    22

    file save as tab delimited change to direct file save

    All,

    A co-worker inherited a process to create a daily file that gets uploaded into email. Currently the macro prompts the user to click on okay to save the file. I'm not sure how to make the macro to just save the file. It gets written to the same file name each day. The filename is "call_data.txt". I'm not sure why they set it up this way. Everything, I've tried hasn't worked. Any help would be greatly appreciated. I'm not sure why they're testing for "Win".

    Here's the exiting code that I want to change to just save the file.

    If Left(Application.OperatingSystem, 3) = "Win" Then
    SaveFileName = Application.GetSaveAsFilename(CurFile, _
    "Text Delimited (*.txt), *.txt", , "Text Delimited Exporter")
    Else
    SaveFileName = Application.GetSaveAsFilename(CurFile, _
    "TEXT", , "Text Delimited Exporter")
    End If

    Thanks in advance.

    Brian

  2. #2
    Valued Forum Contributor tony h's Avatar
    Join Date
    03-14-2005
    Location
    England: London and Lincolnshire
    Posts
    1,187

    Re: file save as tab delimited change to direct file save

    testing for "win" is a check on operating system type (not sure what the non-win option is but probably a Mac option).

    Try
    Please Login or Register  to view this content.


    click on the * Add Reputation if this was useful or entertaining.

  3. #3
    Registered User
    Join Date
    06-10-2004
    Posts
    22

    Re: file save as tab delimited change to direct file save

    Tony,

    Hey. I've been side tracked and trying to figure it out myself, but I'm back.

    "changed the line to,
    "Workbook("xxx").SaveAs Filename:="c:\test\tulanesss.csv", FileFormat:=xlTextMSDOS, CreateBackup:=False"

    With that line I get "sub or function not defined". If I used "ActiveWorkbook", I get "run time error 438". I'm not sure who created this macro, but I'm not sure why they put all this fluff in. Thanks for any help.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: file save as tab delimited change to direct file save

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Valued Forum Contributor tony h's Avatar
    Join Date
    03-14-2005
    Location
    England: London and Lincolnshire
    Posts
    1,187

    Re: file save as tab delimited change to direct file save

    Quote Originally Posted by shg View Post
    Please Login or Register  to view this content.
    oops! Thanks.

  6. #6
    Registered User
    Join Date
    06-10-2004
    Posts
    22

    Re: file save as tab delimited change to direct file save

    Okay, I'm now getting a "Run time error 9 subscript out of range" error. I'm assuming I'm missing a "Dim", but am not sure what I'm missing. I set up a DIM saveas, but that's obviously not what I'm needing. Any help as always, is appreciated. Thanks!

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: file save as tab delimited change to direct file save

    Post your code, in CODE tags.

  8. #8
    Valued Forum Contributor tony h's Avatar
    Join Date
    03-14-2005
    Location
    England: London and Lincolnshire
    Posts
    1,187

    Re: file save as tab delimited change to direct file save

    Quote Originally Posted by bkanealy View Post
    Okay, I'm now getting a "Run time error 9 subscript out of range" error. I'm assuming I'm missing a "Dim", but am not sure what I'm missing. I set up a DIM saveas, but that's obviously not what I'm needing. Any help as always, is appreciated. Thanks!
    It is difficult to help with this without:
    1. knowing what line the error is on
    2. Seeing the whole of the routine (ie from the sub to the end sub or the function to the end function

    Do remember to use code tags (on the toolbar in the forum click on the # to get the code tags)

  9. #9
    Registered User
    Join Date
    06-10-2004
    Posts
    22

    Re: file save as tab delimited change to direct file save

    Sorry about that, thanks for all your help. Here's the code. I've put the line in question in bold.

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    06-10-2004
    Posts
    22

    Re: file save as tab delimited change to direct file save

    bump to get this back in a recent list of messages to view.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Script/macro to save a copy as tab delimited text file and then close original file
    By Merlin803 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-02-2015, 01:34 PM
  2. Macro needed to open "File Save As" and change save file type
    By blainerhett in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-28-2014, 02:40 PM
  3. Automate save to tab delimited file
    By pradhan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-02-2011, 09:58 PM
  4. Save CSV file as Pipe delimited text file
    By germantim in forum Excel General
    Replies: 5
    Last Post: 08-11-2009, 12:21 PM
  5. Replies: 1
    Last Post: 05-03-2005, 06:06 PM
  6. [SOLVED] save excel file from a table delimited file (.txt) using macros
    By sedamfo in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 02-15-2005, 01:06 AM

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