Unfortunately,. I don't see it until after it posts. Revision #2
Sub Format1()
Dim sFile
Dim sFileName As String
sFile = Application.GetOpenFilename("Log Files (*.log), *.log")
If sFile <> False Then
With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & sFile, _
Destination:=Range("A2"))
sFileName = Replace(sFile, ".log", "")
sFileName = Right(sFileName, Len(sFileName) - _
InStrRev(sFileName, "\"))
.Name = sFileName
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 9)
.TextFileFixedColumnWidths = Array(20, 15, 36, 19)
.Refresh BackgroundQuery:=False
End With
ActiveWorkbook.SaveAs _
Filename:=Replace(sFile, ".log", "") & ".xls",_
FileFormat:=xlNormal, _
Password:="", _
WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=False
End If
End Sub
try it and report back.
--
HTH
RP
(remove nothere from the email address if mailing direct)
<mike.engles@btinternet.com> wrote in message
news:1130196567.026632.310250@g43g2000cwa.googlegroups.com...
> Hello
>
> Wow thanks again, some progress.
> The last bit is still red.
> So I deleted that and ran the macro.
> I do get a file open dialogue, so I can browse for a file and the
> macro runs.
> At the end the VB window opens with no text, which I close and see the
> completed macro and then
> I can do a file file save.
>
> I have to say I am very impressed at how anyone could learn this stuff.
> I did some Fortran many many years ago, but was singularly useless at
> it.
>
> My day job is a audio engineer. I need to analyse these error logs from
> a audio ripping programme.
>
> Mike Engles
>
Bookmarks