Re: Importing a changing text file



Thanks Steve

"Steve Rindsberg" wrote:

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

  • Re: Importing a changing text file
    ... Function GetText(sFile As String) As String ... Dim nSourceFile As Integer, sText As String ... This function will load the data from txt file to the textframe. ...
    (microsoft.public.powerpoint)
  • RE: animation macro
    ... I want the animation to be such that first a question appears in red. ... Function GetText(sFile As String) As String ... Dim nSourceFile As Integer, sText As String ...
    (microsoft.public.powerpoint)
  • Re: VBA macro stops executing on Word 2003 but works on Word XP
    ... The macro executes perfectly. ... Dim PatFullName() As String ... ' Load Provider Name into ProvPath var ...
    (microsoft.public.word.vba.general)
  • Re: VBA macro stops executing on Word 2003 but works on Word XP
    ... The macro executes perfectly. ... Dim PatFullName() As String ... ' Load Provider Name into ProvPath var ...
    (microsoft.public.word.vba.general)
  • Re: Problem when I boot...
    ... You have an invalid or remnant entry in a place used to load programs on ... What's likely is that a program neglected to enclose its load string ... enclose the string identifying the program within double quotes if it ... the spaces embedded in the paths to their executables. ...
    (microsoft.public.windowsxp.hardware)