PC Review


Reply
Thread Tools Rate Thread

Add textbox to slide

 
 
Gil
Guest
Posts: n/a
 
      20th May 2007
Hello,

I use the folowing Sub to add a TextBox to the last slide of my ppt,

Sub GetOLETextBoxRef()
Dim shp As Shape
Dim txtBox As TextBox
Dim lastSlideNumber As Integer

lastSlideNumber = ActivePresentation.Slides.Count

' Set a reference to the added shape
Set shp = ActivePresentation.Slides(lastSlideNumber).Shapes. _
AddOLEObject(174#, 222#, 175#, 25#, _
ClassName:="Forms.TextBox.1")
'Now get the object reference from the shape reference
Set txtBox = shp.OLEFormat.Object
' Format properties of the textbox as required.
With txtBox

.Text = "This is the best NG"

End With
End Sub

I want to change textBox properties like: fill, color, hyperlink etc.
I added the folowing code before the last 'End with' but I get error.

.Fill.Visible = msoTrue
.Fill.Solid
.Fill.ForeColor.RGB = RGB(153, 204, 255)
.Fill.Transparency = 0#
.Line.Visible = msoTrue
.Line.ForeColor.SchemeColor = ppForeground
.Line.BackColor.RGB = RGB(255, 255, 255)

How can I modify my textBox properties ?

Thank you
Gil D.

 
Reply With Quote
 
 
 
 
Chirag
Guest
Posts: n/a
 
      20th May 2007
The Fill and Line are properties of the native PowerPoint textbox shape.

For the OLE textbox that you are creating, the background color for the
textbox shape can be set as:
.BackColor = RGB(153, 204, 255)

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html

"Gil" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> I use the folowing Sub to add a TextBox to the last slide of my ppt,
>
> Sub GetOLETextBoxRef()
> Dim shp As Shape
> Dim txtBox As TextBox
> Dim lastSlideNumber As Integer
>
> lastSlideNumber = ActivePresentation.Slides.Count
>
> ' Set a reference to the added shape
> Set shp = ActivePresentation.Slides(lastSlideNumber).Shapes. _
> AddOLEObject(174#, 222#, 175#, 25#, _
> ClassName:="Forms.TextBox.1")
> 'Now get the object reference from the shape reference
> Set txtBox = shp.OLEFormat.Object
> ' Format properties of the textbox as required.
> With txtBox
>
> .Text = "This is the best NG"
>
> End With
> End Sub
>
> I want to change textBox properties like: fill, color, hyperlink etc.
> I added the folowing code before the last 'End with' but I get error.
>
> .Fill.Visible = msoTrue
> .Fill.Solid
> .Fill.ForeColor.RGB = RGB(153, 204, 255)
> .Fill.Transparency = 0#
> .Line.Visible = msoTrue
> .Line.ForeColor.SchemeColor = ppForeground
> .Line.BackColor.RGB = RGB(255, 255, 255)
>
> How can I modify my textBox properties ?
>
> Thank you
> Gil D.
>


 
Reply With Quote
 
Gil
Guest
Posts: n/a
 
      20th May 2007
Thank you for your help.

How can I set hyperlink for my textbox ?

Thank you
Gil D.

 
Reply With Quote
 
Chirag
Guest
Posts: n/a
 
      20th May 2007
You can perhaps write an OnClick event handler for the textbox OLE control
and use ShellExecute() WinApi to launch the hyperlink as follows:

---
Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" ( _
ByVal hWnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long

Sub PrintPDFFile()
ShellExecute 0, "open", http://www.microsoft.com, "", "", 1
End Sub
---

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html

"Gil" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thank you for your help.
>
> How can I set hyperlink for my textbox ?
>
> Thank you
> Gil D.
>


 
Reply With Quote
 
Bill Dilworth
Guest
Posts: n/a
 
      20th May 2007
Hi Gil,

Just out of curiosity, why do you need an ActiveX text box instead of a
regular one? It seems like to are using it in a static form, rather than
the dynamics offered by the ActiveX ones.

If you change the type of text box, it becomes a bit easier to utilize and
insert a hyperlink.

What you are doing isn't wrong, just seemingly harder than it needs to be.


--
Bill Dilworth
A proud member of the Microsoft PPT MVP Team
Users helping fellow users.
http://billdilworth.mvps.org
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
vestprog2@ Please read the PowerPoint FAQ pages.
yahoo. They answer most of our questions.
com www.pptfaq.com
..



"Gil" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> I use the folowing Sub to add a TextBox to the last slide of my ppt,
>
> Sub GetOLETextBoxRef()
> Dim shp As Shape
> Dim txtBox As TextBox
> Dim lastSlideNumber As Integer
>
> lastSlideNumber = ActivePresentation.Slides.Count
>
> ' Set a reference to the added shape
> Set shp = ActivePresentation.Slides(lastSlideNumber).Shapes. _
> AddOLEObject(174#, 222#, 175#, 25#, _
> ClassName:="Forms.TextBox.1")
> 'Now get the object reference from the shape reference
> Set txtBox = shp.OLEFormat.Object
> ' Format properties of the textbox as required.
> With txtBox
>
> .Text = "This is the best NG"
>
> End With
> End Sub
>
> I want to change textBox properties like: fill, color, hyperlink etc.
> I added the folowing code before the last 'End with' but I get error.
>
> .Fill.Visible = msoTrue
> .Fill.Solid
> .Fill.ForeColor.RGB = RGB(153, 204, 255)
> .Fill.Transparency = 0#
> .Line.Visible = msoTrue
> .Line.ForeColor.SchemeColor = ppForeground
> .Line.BackColor.RGB = RGB(255, 255, 255)
>
> How can I modify my textBox properties ?
>
> Thank you
> Gil D.
>



 
Reply With Quote
 
Gil
Guest
Posts: n/a
 
      20th May 2007
Hi Bill,

I am new to powerpoint VBA.
I found this ActiveX text box example in microsoft.public.powerpoint.

I did not find an example of regular textbox.

Can you tell me where can I find VBA code for this ?

Thank you
Gil D.

 
Reply With Quote
 
Gil
Guest
Posts: n/a
 
      20th May 2007
Hi Chirag,

Thank you for your help.
I think that using a regular TextBox will be easier for me (as Bill
said).

Thank you
Gil D.

 
Reply With Quote
 
Bill Dilworth
Guest
Posts: n/a
 
      21st May 2007
This should get you within plug-n-play range ....


-------begin code---------

Sub AddRegularTextBox()

Dim lastSlideNumber As Integer
lastSlideNumber = ActivePresentation.Slides.Count

With ActivePresentation.Slides(lastSlideNumber) _
.Shapes.AddTextbox _
(msoTextOrientationHorizontal, _
174, 222, 300, 100)

.TextFrame.AutoSize = ppAutoSizeNone
.TextFrame.VerticalAnchor = msoAnchorMiddle

With .TextFrame.TextRange
.Text = "Yes, it is"
.ActionSettings(ppMouseClick).Hyperlink _
.Address = "http:\\www.pptfaq.com"
' Note the hyperlink color will override this
.Font.Color.RGB = RGB(255, 0, 0)
.Font.Shadow = msoTrue
.ParagraphFormat.Alignment = ppAlignCenter
.Font.Size = 45
End With

With .Line
.ForeColor.RGB = vbBlue
.Transparency = 0
.Visible = msoTrue
End With

With .Fill
.ForeColor.RGB = RGB(255, 0, 0)
.Transparency = 0.5
.OneColorGradient msoGradientDiagonalUp, 4, 1
End With

End With

End Sub

-------end code---------


--
Bill Dilworth
A proud member of the Microsoft PPT MVP Team
Users helping fellow users.
http://billdilworth.mvps.org
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
vestprog2@ Please read the PowerPoint FAQ pages.
yahoo. They answer most of our questions.
com www.pptfaq.com
..

"Gil" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Bill,
>
> I am new to powerpoint VBA.
> I found this ActiveX text box example in microsoft.public.powerpoint.
>
> I did not find an example of regular textbox.
>
> Can you tell me where can I find VBA code for this ?
>
> Thank you
> Gil D.
>



 
Reply With Quote
 
Gil
Guest
Posts: n/a
 
      21st May 2007
Hi Bill,

Thank you very much. Is solved my problem.

I have another queastion:
I have a slide named "main report" in which there are some Rectangle
with hyperlinks.

How can I choose this slide by name using VBA in order to update
links ?

I tried the following code but it did not work:

Sub GoToNamedSlide()
ActivePresentation.SlideShowWindow.View.GotoSlide _
ActivePresentation.Slides("main report").SlideIndex
End Sub

Thank you
GIl

 
Reply With Quote
 
Gil
Guest
Posts: n/a
 
      21st May 2007
Hi Bill,

Thank you very much. You solved my problem.

I have another queastion:
I have a slide named "main report" in which there are some Rectangle
with hyperlinks.

How can I choose this slide by name using VBA in order to update
links ?

I tried the following code but it did not work:

Sub GoToNamedSlide()
ActivePresentation.SlideShowWindow.View.GotoSlide _
ActivePresentation.Slides("main report").SlideIndex
End Sub

Thank you
GIl

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Powerpoint textbox copy from slide to slide sccrgod Microsoft Powerpoint 4 9th May 2008 08:27 PM
Setting focus to a textbox on a slide John Crawford Microsoft Powerpoint 2 2nd Jan 2008 07:52 PM
Using slide textbox value in module =?Utf-8?B?R3JlZw==?= Microsoft Powerpoint 13 28th Aug 2007 08:17 PM
Textbox in Slide Presentation =?Utf-8?B?a2phbGo=?= Microsoft Powerpoint 1 26th Jan 2007 03:13 PM
move to a slide containing a specific value in a textbox Julied_ng@ReMoVeThIshcts.net.au Microsoft Powerpoint 1 13th Jul 2005 02:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:47 AM.