Results 1 to 5 of 5
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    save file (2000 sr 1)

    i open a file with this comand line:

    Vfile = Application.GetOpenFilename


    after i have selected this from the open file window i would want to save in c:epf with this characteristic:

    namafile_11102004

    NOTE: THIS FILE IS A TXT FILE

    in effect i want save this with the date of system...

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: save file (2000 sr 1)

    Is the file you open a text file, or is the file you want to save a text file, or both?

    Is "namafile" a literal name, or does it stand for the name of the file?

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: save file (2000 sr 1)

    ... the opened file is txt file
    the name of file it must have the name of variable vFile plus "_" and the date...

    here a piece of my macro:

    Sub IMPORT_T2253()

    Dim RIGA As String
    Dim cont As Integer

    cont = 3

    Range("A3:Q5000").Select
    Selection.ClearContents

    Range("A3").Select

    Dim vFile
    vFile = Application.GetOpenFilename

    in my case the file that i open have a name T2253...

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: save file (2000 sr 1)

    Dim strSaveName As String
    If Right(vFile, 4) = ".txt" Then
    strSaveName = Left(vFile, Len(vFile) - 4)
    Else
    strSaveName = vFile
    End If
    strSaveName = strSaveName & "_" & Format(Date, "ddmmyyyy") & ".txt"
    ActiveWorkbook.SaveAs FileName:=strSaveName, FileFormat:=xlUnicodeText

  5. #5
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: save file (2000 sr 1)

    Does the textfile have to be opened in Excel first?
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

Posting Permissions

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