Lm th? no ? t? ?ng ho PowerPoint b?ng cch s? d?ng Visual Basic trong Office 2003, Office XP nh pht tri?n, v trong nh pht tri?n Office 2000

D?ch tiu ? D?ch tiu ?
ID c?a bi: 222929 - Xem s?n ph?m m bi ny p d?ng vo.
Bung t?t c? | Thu g?n t?t c?


Bi vi?t ny m t? lm th? no ? t? ?ng ho Microsoft PowerPoint b?ng cch s? d?ng Microsoft Visual Basic trong Microsoft Office 2003, Microsoft Office XP nh pht tri?n, v trong Microsoft Office 2000 nh pht tri?n.


B?ng cch s? d?ng t? ?ng ha trong PowerPoint, b?n c th? l?p tr?nh in, hi?n th? trang tr?nh by, v lm h?u h?t nh?ng i?u b?n c th? tng tc. Lm theo cc b?c sau ? xy d?ng v ch?y m?t v d? t? ?ng ha Visual Basic:
  1. T?o m?t d? n m?i c?a tiu chu?n EXE. Form1 ?c t?o ra b?i m?c ?nh.
  2. Thm m?t CommandButton m?c ?nh m?u.
  3. T? cc D an tr?nh n, nh?p vo Tham khao, v thm Microsoft PowerPoint 8,0 ?i t?ng th vi?n v Microsoft Office 8,0 ?i t?ng th vi?n. ?i v?i Office 2000, y l phin b?n 9.0 cc th vi?n ki?u. Cho vn ph?ng 2002, y l phin b?n 10,0. ?i v?i Microsoft Office 2003, y l Phin b?n 11,0.
  4. Thm sau vo c?a s? c?a b?n m? m?u:
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    Private Sub Command1_Click()
        ' Start PowerPoint.
        Dim ppApp As PowerPoint.Application
        Set ppApp = CreateObject("Powerpoint.Application")
        ' Make it visible.
        ppApp.Visible = True
        ' Add a new presentation.
        Dim ppPres As PowerPoint.Presentation
        Set ppPres = ppApp.Presentations.Add(msoTrue)
        ' Add a new slide.
        Dim ppSlide1 As PowerPoint.Slide
        Set ppSlide1 = ppPres.Slides.Add(1, ppLayoutText)
        ' Add some text.
        ppSlide1.Shapes(1).TextFrame.TextRange.Text = "My first slide"
        ppSlide1.Shapes(2).TextFrame.TextRange.Text = "Automating Powerpoint is easy" & vbCr & "Using Visual Basic is fun!"
        ' Add another slide, with a chart.
        Dim ppSlide2 As PowerPoint.Slide
        Set ppSlide2 = ppPres.Slides.Add(2, ppLayoutTextAndChart)
        ' Add some text.
        ppSlide2.Shapes(1).TextFrame.TextRange.Text = "Slide 2's topic"
        ppSlide2.Shapes(2).TextFrame.TextRange.Text = "You can create and use charts in your Powerpoint slides!"
        ' Add a chart in the same location as the old one.
        Dim cTop As Double
        Dim cWidth As Double
        Dim cHeight As Double
        Dim cLeft As Double
        With ppSlide2.Shapes(3)
            cTop = .Top
            cWidth = .Width
            cHeight = .Height
            cLeft = .Left
        End With
        ppSlide2.Shapes.AddOLEObject cLeft, cTop, cWidth, cHeight, "MSGraph.Chart"
        ' Add another slide, with an organization chart.
        Dim ppSlide3 As PowerPoint.Slide
        Set ppSlide3 = ppPres.Slides.Add(3, ppLayoutOrgchart)
        ' Add some text.
        ppSlide3.Shapes(1).TextFrame.TextRange.Text = "The rest is only limited by your Imagination"
        ' Add an Org Chart in the same location as the old one.
        With ppSlide3.Shapes(2)
            cTop = .Top
            cWidth = .Width
            cHeight = .Height
            cLeft = .Left
        End With
        ppSlide3.Shapes.AddOLEObject cLeft, cTop, cWidth, cHeight, "OrgPlusWOPX.4" 'OrgPlusWOPX.4 
        ' is an object of the application Microsoft Organization Chart
        ' Setup slide show properties.
        With ppPres.Slides.Range.SlideShowTransition
            .EntryEffect = ppEffectRandom
            .AdvanceOnTime = msoTrue
            .AdvanceTime = 5 ' 5 seconds per slide
        End With
        ' Prepare and run the slide show.
        With ppPres.SlideShowSettings
            .ShowType = ppShowTypeKiosk
            .LoopUntilStopped = msoTrue
            .RangeType = ppShowAll
            .AdvanceMode = ppSlideShowUseSlideTimings
        End With
        ' Sleep so user can watch the show.
        Sleep (15000)
        ' Clean up.
    End Sub
  5. Ch?y cc d? n.


? bi?t thm chi ti?t v? vn ph?ng t? ?ng ha, truy c?p vo cc Pht tri?n vn ph?ng Microsoft h? tr? trang Web:

Thu?c tnh

ID c?a bi: 222929 - L?n xem xt sau cng: 21 Thang Tam 2011 - Xem xt l?i: 2.0
p d?ng
  • Microsoft Office XP Developer Edition
  • Microsoft Office 2000 Developer Edition
  • Microsoft Visual Basic 5.0 Professional Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 5.0 Enterprise Edition
  • Microsoft Office PowerPoint 2003
  • Microsoft PowerPoint 2002 Standard Edition
  • Microsoft PowerPoint 2000 Standard Edition
  • Microsoft PowerPoint 97 Standard Edition
T? kha:
kbautomation kbhowto kbmt KB222929 KbMtvi
My d?ch
QUAN TRONG: Bi vi?t ny ?c d?ch b?ng ph?n m?m d?ch my c?a Microsoft ch? khng ph?i do con ng?i d?ch. Microsoft cung c?p cc bi vi?t do con ng?i d?ch v c? cc bi vi?t do my d?ch ? b?n c th? truy c?p vo t?t c? cc bi vi?t trong C s? Ki?n th?c c?a chng ti b?ng ngn ng? c?a b?n. Tuy nhin, bi vi?t do my d?ch khng ph?i lc no c?ng hon h?o. Lo?i bi vi?t ny c th? ch?a cc sai st v? t? v?ng, c php ho?c ng? php, gi?ng nh m?t ng?i n?c ngoi c th? m?c sai st khi ni ngn ng? c?a b?n. Microsoft khng ch?u trch nhi?m v? b?t k? s? thi?u chnh xc, sai st ho?c thi?t h?i no do vi?c d?ch sai n?i dung ho?c do ho?t ?ng s? d?ng c?a khch hng gy ra. Microsoft c?ng th?ng xuyn c?p nh?t ph?n m?m d?ch my ny.
Nh?p chu?t vo y ? xem b?n ti?ng Anh c?a bi vi?t ny:222929

Cung cp Phan hi


Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com