add text from file...

Posted on 2012-08-14
Medium Priority
Last Modified: 2012-09-17
Hi I want somehow  the simplest way do this.

1. Search in textfile. ( Can call it .ini .txt .csv or whatever... )
The textfile will have this contet

13/8      Kaj
14/8      Uno
15/8      Estelle
15/8      Stella
16/8      Brynolf
17/8      Valter
17/8      Verner
18/8      Ellen
18/8      Lena
19/8      Magnus
19/8      Måns
20/8      Bernhard
20/8      Bernt
21/8      Jon
21/8      Jonna
22/8      Henrietta
22/8      Henrika
23/8      Signe
23/8      Signhild
24/8      Bartolomeus
25/8      Louise
25/8      Lovisa
26/8      Östen
27/8      Raoul
27/8      Rolf
28/8      Gurli
28/8      Leila
29/8      Hampus
29/8      Hans
30/8      Albert
30/8      Albertina
31/8      Arvid
31/8      Vidar

What I would like to do is search for todays date. 14/8 (14/8      Uno) and then write out "Uno" to a powerpoint textbox or something like that...

So I want the powerpoint to every days namedays added...

The code can be done in VB or i .bat file...
Question by:kavvis
LVL 23

Accepted Solution

JSRWilson earned 2000 total points
ID: 38291606
Try this vba

Sub getText_Today()
Dim iFileNum As Integer
Dim sFileName As String
Dim strText As String
Dim strTest As String
Dim ipos As Integer
' change the path here
sFileName = Environ("USERPROFILE") & "\Desktop\data.txt"
iFileNum = FreeFile()
strTest = CStr(Day(Now) & "/" & Month(Now))
Open sFileName For Input As iFileNum
Do While Not EOF(iFileNum)
Line Input #iFileNum, strText
If Left(strText, 4) = strTest Then
ipos = InStrRev(strText, " ")
ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange = Mid(strText, ipos + 1)
Exit Do
End If
End Sub

Author Closing Comment

ID: 38405079
Works perfect.. thank you

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

People often ask "How do I make this macro run every time I show a new slide or add a new slide etc." This means making PowerPoint respond to that EVENT and, unlike in Excel, it's not that easy! First, I would avoid using the pseudo events left o…
This article shows how to simulate drawing numbers or names from a hat or bag using vba in PowerPoint and prevents duplicate items being selected. It’s not difficult to choose a (semi) random number in vba. The RND function returns a decimal numb…
The viewer will learn how to edit animations within the presentation, incorporate sound, and set everything up with timing.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
Suggested Courses
Course of the Month16 days, 19 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question