|
-
Jul 23rd, 2008, 06:00 AM
#1
Thread Starter
New Member
.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
-
Jul 23rd, 2008, 07:11 AM
#2
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?
-
Jul 23rd, 2008, 08:26 AM
#3
Thread Starter
New Member
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
-
Jul 23rd, 2008, 10:18 AM
#4
Fanatic Member
Re: .dat to .xls converter
He can't help you unless you answer his question.
-
Jul 24th, 2008, 02:45 AM
#5
Thread Starter
New Member
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
-
Jul 24th, 2008, 03:23 AM
#6
Fanatic Member
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.
-
Jul 24th, 2008, 06:33 AM
#7
Thread Starter
New Member
Re: .dat to .xls converter
so is there anything i could do about it, or looks like no solution for it??!!
-
Jul 24th, 2008, 06:58 AM
#8
Fanatic Member
Re: .dat to .xls converter
You're not making sense. You said it was taken care of. Make your mind up!
-
Jul 24th, 2008, 08:47 AM
#9
Addicted Member
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
-
Jul 24th, 2008, 10:17 AM
#10
Thread Starter
New Member
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
-
Jul 24th, 2008, 01:02 PM
#11
Re: .dat to .xls converter
 Originally Posted by mahmouddraj
does that script copy the file from server A to server B and then rename it as .xls
Yes.
-
Jul 25th, 2008, 01:24 AM
#12
Thread Starter
New Member
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
-
Jul 28th, 2008, 02:16 AM
#13
Addicted Member
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:
Public Sub TestFileProperties()
' Purpose: Demonstrates the use of the VBA FileDateTime
' and FileLen functions.
' Create the following file in your C:\ drive.
Const FILE_PATH As String = "C:\SampleFile.txt"
On Error GoTo TestFileProperties_Err
' List the created/modified date and the number of bytes
' for the file.
MsgBox Prompt:="'" & FILE_PATH & "' was created or last " & _
"modified on " & FileDateTime(pathname:=FILE_PATH) & "."
MsgBox Prompt:="'" & FILE_PATH & "' contains " & _
FileLen(pathname:=FILE_PATH) & " bytes."
TestFileProperties_End:
Exit Sub
TestFileProperties_Err:
Select Case Err.Number
Case 53 ' File not found.
MsgBox Prompt:="Can't find file '" & FILE_PATH & "'. " & _
"Check the file path and try again."
Case Else
MsgBox "Error number: " & Err.Number & vbCrLf & _
"Description: " & Err.Description
End Select
Resume TestFileProperties_End
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|