Results 1 to 13 of 13

Thread: .dat to .xls converter

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    6

    .dat to .xls converter

    Hi guys,
    looks a great forum, first time posting and hope i get some help, i am not really pro in VB but trying to learn. however, am trying develop a little app, its a converter from .dat to .xls. the way i wanted is like that:
    1) .dat files in server A
    2) search for the latest files (up-to-date) that been in that server
    3) copy .dat files to server B and rename as .xls

    sounds like its simple but not sure how to do it..
    any help out there i'll appreciated

    Thanks in advance

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: .dat to .xls converter

    Welcome to the forums.

    So basically you simply need to import a .dat file into an Excel spreadsheet, right? (Simply renaming them really isn't goint to put them in an excel format for you)

    What kind of format are you .dat files in?

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    6

    Re: .dat to .xls converter

    .dat files are located in Server A, they are protected and cant be modified but when i copy .dat file into Server B and rename it as .xls, i'll be able able to modify it, as the original copy still in Server A, the reason am looking for a little app is because i have hundreds of these files and hardly be doing one by one and track the recent ones...

    thanks for the replay anyway and i hope you could help me

  4. #4
    Fanatic Member dmaruca's Avatar
    Join Date
    May 2006
    Location
    Jacksonville, FL
    Posts
    577

    Re: .dat to .xls converter

    He can't help you unless you answer his question.

  5. #5

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    6

    Re: .dat to .xls converter

    .dat is an output from an application called SAP Front End. renaming is the easiest solution so no need for any conversion

  6. #6
    Fanatic Member dmaruca's Avatar
    Join Date
    May 2006
    Location
    Jacksonville, FL
    Posts
    577

    Re: .dat to .xls converter

    Sounds like they output plain text or csv. .dat is usually a catch all file extension that could be anything depending on the program making it. Luckily it's not binary.

  7. #7

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    6

    Re: .dat to .xls converter

    so is there anything i could do about it, or looks like no solution for it??!!

  8. #8
    Fanatic Member dmaruca's Avatar
    Join Date
    May 2006
    Location
    Jacksonville, FL
    Posts
    577

    Re: .dat to .xls converter

    You're not making sense. You said it was taken care of. Make your mind up!

  9. #9
    Addicted Member
    Join Date
    Jan 2007
    Location
    England
    Posts
    234

    Re: .dat to .xls converter

    dmaruca you tool, get off his case

    if you aren't gonna help him, why bother replyin?

    Code:
    Sub copy_files()
    Dim ServerA As String
    Dim ServerB As String
    
    ServerA = "C:\temp\filename.dat" ' original filepath on Server A
    ServerB = "C:\temp\filename2.xls" ' new filepath on Server B
    
    FileCopy ServerA, ServerB
    
    
    End Sub

  10. #10

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    6

    Re: .dat to .xls converter

    thanks Mitch_s_s

    does that script copy the file from server A to server B and then rename it as .xls

    *** sorry for the stupid question *** you can say am dummy in VB just trying to understand

    how can i make search for the last updated file and then copy those recent files to server B

  11. #11
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: .dat to .xls converter

    Quote Originally Posted by mahmouddraj
    does that script copy the file from server A to server B and then rename it as .xls
    Yes.

  12. #12

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    6

    Re: .dat to .xls converter

    - lets pretend .dat files in this path
    \\serverA\data\test.dat

    and i want to copy this file to and rename as xls
    \\serverB\data\test.xls

    - find the latest files up-to-date and copy + rename

  13. #13
    Addicted Member
    Join Date
    Jan 2007
    Location
    England
    Posts
    234

    Re: .dat to .xls converter

    just found this

    here

    Get Quick Access to File Properties by Using the VBA File Functions
    You can quickly obtain file properties such as the created date, the last modified date, or the number of bytes in a file by using the VBA FileDateTime and FileLen functions, for example:

    vb Code:
    1. Public Sub TestFileProperties()
    2.  
    3.     ' Purpose: Demonstrates the use of the VBA FileDateTime
    4.     ' and FileLen functions.
    5.    
    6.     ' Create the following file in your C:\ drive.
    7.     Const FILE_PATH As String = "C:\SampleFile.txt"
    8.    
    9.     On Error GoTo TestFileProperties_Err
    10.    
    11.     ' List the created/modified date and the number of bytes
    12.     ' for the file.
    13.     MsgBox Prompt:="'" & FILE_PATH & "' was created or last " & _
    14.         "modified on " & FileDateTime(pathname:=FILE_PATH) & "."
    15.     MsgBox Prompt:="'" & FILE_PATH & "' contains " & _
    16.         FileLen(pathname:=FILE_PATH) & " bytes."
    17.        
    18. TestFileProperties_End:
    19.     Exit Sub
    20.    
    21. TestFileProperties_Err:
    22.     Select Case Err.Number
    23.         Case 53     ' File not found.
    24.             MsgBox Prompt:="Can't find file '" & FILE_PATH & "'. " & _
    25.                 "Check the file path and try again."
    26.         Case Else
    27.             MsgBox "Error number: " & Err.Number & vbCrLf & _
    28.                 "Description: " & Err.Description
    29.     End Select
    30.    
    31.     Resume TestFileProperties_End
    32.  
    33. End Sub

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