|
-
May 13th, 2006, 03:25 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] adding a text box to a powerpoint slide
Hey,
using MS Access, I've created a powerpoint slide with a pie chart based on a query. what I'd like to do now is add a text box with a title to this slide.
for adding the chart I've used an MS article that uses this line:
Set shpGraph = OpwrPresent.Shapes.AddOLEObject(left:=LLeft, _
top:=lTop, Width:=lwidth, Height:=lheight, _
ClassName:="MSGraph.Chart", Link:=0).OLEFormat.Object
any idea what classname is used for text box? or if I should do this in another way?
-
May 13th, 2006, 03:34 PM
#2
Re: adding a text box to a powerpoint slide
Record a macro in powerpoint adding the textbox. Then check out the generated module code to see how its done. Then move/modify it to Access.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 14th, 2006, 12:38 AM
#3
Thread Starter
Fanatic Member
Re: adding a text box to a powerpoint slide
this is the code I got:
-------------------------
VB Code:
Const msotrue = True
Const msofalse = False
Const msoTextOrientationHorizontal = True
ActiveWindow.Selection.SlideRange.Shapes.AddTextbox(msoTextOrientationHorizontal, 53.875, 389.125, 119#, 28.875).Select
ActiveWindow.Selection.ShapeRange.TextFrame.WordWrap = msotrue
With ActiveWindow.Selection.TextRange.ParagraphFormat
.LineRuleWithin = msotrue
.SpaceWithin = 1
.LineRuleBefore = msotrue
.SpaceBefore = 0.5
.LineRuleAfter = msotrue
.SpaceAfter = 0
End With
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Characters(Start:=1, Length:=0).Select
With ActiveWindow.Selection.TextRange
.Text = "rwerwerwr"
With .Font
.Name = "Arial"
.NameComplexScript = "Arial"
.NameOther = "Arial"
.Size = 18
.Bold = msofalse
.Italic = msofalse
.Underline = msofalse
.Shadow = msofalse
.Emboss = msofalse
.BaselineOffset = 0
.AutoRotateNumbers = msofalse
' .Color.SchemeColor = ppForeground
End With
End With
ActiveWindow.Selection.SlideRange.Shapes("Object 9").Select
------------------
( I added the first 3 lines)
I get error 91 object variable or with block not set
Last edited by RobDog888; May 14th, 2006 at 02:06 AM.
Reason: Added [vbcode] tags
-
May 14th, 2006, 02:07 AM
#4
Re: adding a text box to a powerpoint slide
What line is giving you the error? Did you create a object variable for the application object of powerpoint so Access doesnt get confused with its application object?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 14th, 2006, 06:08 AM
#5
Thread Starter
Fanatic Member
Re: adding a text box to a powerpoint slide
I know I need :
Dim OPwrPnt As Object
Set OPwrPnt = CreateObject("Powerpoint.application")
but how to connect OPwrpnt to this code?
-
May 14th, 2006, 07:48 AM
#6
Re: adding a text box to a powerpoint slide
have you set reference to Powerpoint object library?
-
May 14th, 2006, 08:25 AM
#7
Thread Starter
Fanatic Member
Re: adding a text box to a powerpoint slide
It will be easier for me if you could please relate to the above code as the only code, and if anything is missing (and it is only few lines) sugget it as something to solve my problem.
-
May 14th, 2006, 09:49 AM
#8
Thread Starter
Fanatic Member
Re: adding a text box to a powerpoint slide
anyone? I know this must be simple...
-
May 14th, 2006, 10:51 AM
#9
Thread Starter
Fanatic Member
Re: adding a text box to a powerpoint slide
Ok I added "OPwrPnt." before every "activewindow..."
It still doesn't run saying msoTextOrientationHorizontal, msoFalse, and msoTrue are not defined in MS Acesss (but are defined in Powerpoint)
I tried to defined them as const text string, but it I get type mismatch error:
Const msoTextOrientationHorizontal = "msoTextOrientationHorizontal"
-
May 14th, 2006, 02:52 PM
#10
Re: adding a text box to a powerpoint slide
If you added a reference to PowerPoint then you shouldnt need to manuall define the consts.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 15th, 2006, 01:31 AM
#11
Thread Starter
Fanatic Member
Re: adding a text box to a powerpoint slide
Ok, I think I got It. thanks a lot !
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|