ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Opening and saving textfile into XLS (https://www.excelbanter.com/excel-programming/273441-opening-saving-textfile-into-xls.html)

MicMast

Opening and saving textfile into XLS
 
Hey reader,

I'm trying to make a chart of a few txt files.
I can open the txt files using:
logtext = InputBox("Give the name of the file to add", "Name of the
LogFile")
logfile = ThisWorkbook.Path & "\" & logtext & ".txt"
Workbooks.OpenText FileName:=logfile, _
Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited,
TextQualifier:= _
xlNone, ConsecutiveDelimiter:=True, Tab:=False, Semicolon:=False
_
, Comma:=False, Space:=True, Other:=False, OtherChar:=False

but that opens the txt file and them puts everything in the right
colums and rows. But now I want to save it as an .xls

I tried using thisworkbook.save(path of the file)
but then I saved the file where the button is standing to read the
log...
any ideas?

And one more thing, how do I use the data in the txtfile to make a
chart?
Thx in advance
micmast

Tom Ogilvy

Opening and saving textfile into XLS
 
thisworkbook.save "C:\my path\logtext.xls", xlWorkbookNormal

Turn on the macro recorder and create your graph manually. That should give
you a good start.

Regards,
Tom Ogilvy


"MicMast" wrote in message
om...
Hey reader,

I'm trying to make a chart of a few txt files.
I can open the txt files using:
logtext = InputBox("Give the name of the file to add", "Name of the
LogFile")
logfile = ThisWorkbook.Path & "\" & logtext & ".txt"
Workbooks.OpenText FileName:=logfile, _
Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited,
TextQualifier:= _
xlNone, ConsecutiveDelimiter:=True, Tab:=False, Semicolon:=False
_
, Comma:=False, Space:=True, Other:=False, OtherChar:=False

but that opens the txt file and them puts everything in the right
colums and rows. But now I want to save it as an .xls

I tried using thisworkbook.save(path of the file)
but then I saved the file where the button is standing to read the
log...
any ideas?

And one more thing, how do I use the data in the txtfile to make a
chart?
Thx in advance
micmast





All times are GMT +1. The time now is 06:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com