Re: Importing a changing text file



A couple of minor quibbles:

Sub ReadTextToTextFrame()
'load data to textframe of a shape
ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange.Text =
GetText("C:\\test.txt")

Make that:
GetText("C:\test.txt")

One backslash instead of two

End Sub
'http://www.exceluser.com/explore/questions/vba_textcols.htm
Function GetText(sFile As String) As String
Dim nSourceFile As Integer, sText As String

''Close any open text files
Close

''Get the number of the next free text file
nSourceFile = FreeFile

''Write the entire file to sText
Open sFile For Input As #nSourceFile
sText = Input$(LOF(1), 1)

Just be aware that this will bite you if the text file is double-byte encoded
(ie, in Chinese/Japanese/Korean etc) or, I suspect, Unicode.

A routine that reads a line of input at a time and appends it to sText solves
that problem. In theory it's a bit slower. In practice, unless your files are
huge, there'll be no difference.

Close

GetText = sText
End Function

This function will load the data from txt file to the textframe. You can
call this fuction at the start up.
http://skp.mvps.org/autoevents.htm

Another option is to create an addin which populates data from the file

"Simon Keeling" wrote:

Hi,

I have a text file which changes 6-times daily (it contains weather
data).

Is it possible to imort this text file and for it to automatically
update when I load the powerpoint presntation, pretty much link
linking to an image?

Thanks in advance,
Simon Keeling



-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================


.



Relevant Pages