dotnetspider.com


 


TutorialsForumResourcesReviewsJobsInterviewVideosCommunitiesProjectsTraining

Subscribe to Subscribers


Online MembersSunitha
Prasad kulkarni
Prabu Thangavelu
chaminda
sravan
cloud
Shesh Kumar Mishra
Gajanan
pavan
Anu George
somasekar
More...




Resources » Code Snippets » Graphics


Power point presentation in VB.net


Posted Date:     Category: Graphics    Rating: 1 out of 5
Author: Member Level: Gold    Points: 10 (Rs 10)


We can run the power point presentation in VB.net

Following is the Name space required for this presentation


Imports Office = Microsoft.Office.Core
Imports Graph = Microsoft.Office.Interop.Graph
Imports PowerPoint = Microsoft.Office.Interop.PowerPoint


Create one windows application.
Create one button control.
In the button control double click write the
following code.



Const MyTemplate = "C:\Program Files\Microsoft Office\Templates\Presentation Designs\Blends.pot"
Const MyPicture = "C:\WINNT\Soap Bubbles.bmp"

Dim MyApplication As PowerPoint.Application
Dim MyPresentation As PowerPoint.Presentation
Dim MySlide As PowerPoint.Slide
Dim MyAssistantOn As Boolean


MyApplication = New PowerPoint.Application()
MyApplication.Visible = True
MyApplication.WindowState = PowerPoint.PpWindowState.ppWindowMinimized

MyPresentation = MyApplication.Presentations.Open(sTemplate, , , True)


MySlide = MyPresentation.Slides.Add(1, PowerPoint.PpSlideLayout.ppLayoutTitleOnly)
With MySlide.Shapes.Item(1).TextFrame.TextRange
.Text = "My Presentation"
.Font.Name = "Vardana"
.Font.Size = 36
End With
MySlide.Shapes.AddPicture(MyPicture, False, True, 150, 150, 500, 350)
MySlide = Nothing

MySlide = MyPresentation.Slides.Add(2, PowerPoint.PpSlideLayout.ppLayoutTitleOnly)
With MySlide.Shapes.Item(1).TextFrame.TextRange
.Text = "My Chart Presentation"
.Font.Name = "Comic Sans MS"
.Font.Size = 48
End With
Dim MyChart As Graph.Chart
MyChart = MySlide.Shapes.AddOLEObject(150, 150, 480, 320,MSGraph.Chart.8").OLEFormat.Object

MyChart.ChartType = Graph.XlChartType.xl3DPie
MyChart = Nothing
MySlide = Nothing

MySlide = MyPresentation.Slides.Add(3, PowerPoint.PpSlideLayout.ppLayoutBlank)
MySlide.FollowMasterBackground = False
Dim MyShape As PowerPoint.Shape
MyShape = MySlide.Shapes.AddTextEffect(Office.MsoPresetTextEffect.msoTextEffect27,
"The End", "Impact", 96, False, False, 230, 200)
MyShape.Shadow.ForeColor.SchemeColor = PowerPoint.PpColorSchemeIndex.ppForeground
MyShape.Shadow.Visible = True
MyShape.Shadow.OffsetX = 3
MyShape.Shadow.OffsetY = 3
MyShape = Nothing
MySlide = Nothing

Dim SlideIdx(3) As Integer
SlideIdx(0) = 1
SlideIdx(1) = 2
SlideIdx(2) = 3
With MyPresentation.Slides.Range(SlideIdx).SlideShowTransition
.AdvanceOnTime = True
.AdvanceTime = 3
.EntryEffect = PowerPoint.PpEntryEffect.ppEffectBoxOut
End With
Dim MySettings As PowerPoint.SlideShowSettings
MySettings = MyPresentation.SlideShowSettings
MySettings.StartingSlide = 1
MySettings.EndingSlide = 3

MyAssistantOn = MyApplication.Assistant.On
MyApplication.Assistant.On = False

MySettings.Run()
Do While MyApplication.SlideShowWindows.Count >= 1
System.Windows.Forms.Application.DoEvents()
Loop
MySettings = Nothing

If MyAssistantOn Then
MyApplication.Assistant.On = True
MyApplication.Assistant.Visible = False
End If

MyPresetation.Saved = True
MyPresetation.Close()
MyPresetation = Nothing
MyApplication.Quit()
MyApplication = Nothing
GC.Collect()
End Sub




When you click the button you can see the power point presentation.

Thanks
Nathan


Did you like this resource? Share it with your friends and show your love!





Responses to "Power point presentation in VB.net"

No responses found. Be the first to respond...

Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: C++ Code to Draw a Hut using "graphics.h" header
    Previous Resource: Resize an image
    Return to Resources
    Post New Resource
    Category: Graphics


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    PPT  .  

    My Profile

    Active Members
    TodayLast 7 Daysmore...


    Awards & Gifts


    Email subscription
  • .NET Jobs
  • .NET Articles
  • .NET Forums
  • Articles Rss Feeds
    Forum Rss Feeds



    About Us    Trademark Disclaimer    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.