ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   retrieving Text from a textfile in Excel (https://www.excelbanter.com/excel-programming/362058-retrieving-text-textfile-excel.html)

Silencer116

retrieving Text from a textfile in Excel
 
Hi again!

I am using some methods to create a textfile with just one line. Like "
The process begun at monday 3 PM" or something like that. This line
will always be updated (actually the whole file).

But now i would like the following:

i would like to have the text in the textfile being displayed in a
msgbox in Excel. It's only one single line, but it could be considered
as everything (all text) in the textfile.

Could someone help me on this ?


Ivan Raiminius

retrieving Text from a textfile in Excel
 
Hi,

only part of code, that you can incorporate into yours:

Dim fsFs As Object
Dim fsInput As Object

Set fsFs = CreateObject("Scripting.FileSystemObject")
Set fsInput = fsFs.OpenTextFile(Filename:=InputFile, _
IOMode:=ForReading, create:=False,
_
Format:=TristateUseDefault)
msgbox fsInput.readline
fsInput.close

'Input file = full file name including path

Regards,
Ivan


Nigel

retrieving Text from a textfile in Excel
 
Assign your text to a variable e.g. MyText and display that.....

MsgBox MyText

--
Cheers
Nigel



"Silencer116" wrote in message
oups.com...
Hi again!

I am using some methods to create a textfile with just one line. Like "
The process begun at monday 3 PM" or something like that. This line
will always be updated (actually the whole file).

But now i would like the following:

i would like to have the text in the textfile being displayed in a
msgbox in Excel. It's only one single line, but it could be considered
as everything (all text) in the textfile.

Could someone help me on this ?





All times are GMT +1. The time now is 08:45 PM.

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