Re: Importing a changing text file
- From: vindys <vindys@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 13 Mar 2008 09:35:00 -0700
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
================================================
- References:
- Importing a changing text file
- From: Simon Keeling
- Re: Importing a changing text file
- From: Steve Rindsberg
- Importing a changing text file
- Prev by Date: RE: PowerPoint2007 intercharacter spacing
- Next by Date: Re: PP Viewer 07
- Previous by thread: Re: Importing a changing text file
- Next by thread: bullet display in pull-down menu
- Index(es):
Relevant Pages
|