Re: powerpoint automation via vb.net

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



If you look into my code finding the text in between # is taken care of. if
you print strword it prints all the text between # one by one.
in below code, it sends the entire string in s to textFrame
ppItem.TextFrame.TextRange.Text = s
so I dont know how to make it bold in my if statement where i am doing
msgbox(strword).

please help



"Steve Rindsberg" wrote:


I'm not a .Net user so I can't speak for it. But it looks like you're stepping
through the string to find the start and stop positions marked by #-marks.
Knowing that, you could do this in VBA:

lLength = (lEndPoint - lStartPoint) + 1

.TextFrame.TextRange.Characters(lStartPoint, lLength).Font.Bold = True


In article <0583EE31-C2CA-41CF-AC62-8B6CE77D932D@xxxxxxxxxxxxx>, Bikash wrote:
Hi I am sending a list of records to each textbox in powerpoint. for each
text box if i find any text tahts in between # i need to make them bold. e.g.

"I want #this# bold."

here "this" should be bold when interpreting in powerpoint.
below is the code where i am able to capture the text thats in between #.
The problem is i want only selected text bold and rest normal.

Dim ppItem As Microsoft.Office.Interop.PowerPoint.Shape
If Len(Trim(dr.Item(Strings.Right(Trim(ppItem.TextFrame.TextRange.Text),
Len(Trim(ppItem.TextFrame.TextRange.Text)) - 1)))) > 0 Then

Dim s As String =
dr.Item(Strings.Right(Trim(ppItem.TextFrame.TextRange.Text),
Len(Trim(ppItem.TextFrame.TextRange.Text)) - 1))
s = s.Trim

ppItem.TextFrame.TextRange.Text = s

'ppItem.TextFrame.TextRange.Font.Bold =
Microsoft.Office.Core.MsoTriState.msoFalse
'========================


Dim a, b, looplen As Integer
looplen = s.Length

Dim hashWords As String()

Dim strWord As String
For a = 0 To looplen - 1

If s.Substring(a, 1) =
"#" Then
a += 1
For b = 1 To looplen
- 1
If
s.Substring(a, 1) = "#" Then


'MsgBox(strWord)

ppItem.TextFrame.TextRange.Font.Bold =
Microsoft.Office.Core.MsoTriState.msoCTrue
Else

ppItem.TextFrame.TextRange.Font.Bold =
Microsoft.Office.Core.MsoTriState.msoFalse
strWord = ""

Exit For
End If
strWord +=
s.Substring(a, 1)
a += 1
Next
Else


ppItem.TextFrame.TextRange.Font.Bold =
Microsoft.Office.Core.MsoTriState.msoFalse
End If

Next

In above code i want all the strings send to powerpoint and make strWord bold.

could someone please help me or just give me a clue I am having really hard
time to fix it

thanks


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


.



Relevant Pages

  • Re: 2 different formats of text in a single cell?
    ... Enter the text "Some bold and red words" in A1 and then give this code a try... ... Dim Word As String ... Select the desired formatting, and that will be applied to the def. ...
    (microsoft.public.excel.misc)
  • Re: Using Macros to bold specified text in Excel
    ... you can you know (Bold and colour them anyway - not change the pattern ... This will prompt you for the string and then highlight all instances on the ... Dim j As Integer ... Dim num As Long ...
    (microsoft.public.excel.programming)
  • Re: search form w/ no duplicates
    ... Subquery Basics: Filters and Searches ... Dim strWhere As String ... Dim strWord As String ...
    (microsoft.public.access.formscoding)
  • Re: Find page number for each word in document
    ... Do I need to set strWord as something before this will ... For Each strWord In colWords ... creates a string called strWord from the Range called strWord!!! ... Dim fso As Scripting.FileSystemObject ...
    (microsoft.public.word.vba.general)
  • Re: Search 3 Fields in one form, from one text box.
    ... how to parse the words typed into the text box; ... Dim strWhere As String ... Dim strWord As String ...
    (microsoft.public.access.formscoding)