ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] excel ¦Û°ÊÂà´« PPT

[µo°Ý] excel ¦Û°ÊÂà´« PPT

¤p§Ì¦³ÂI¤p³Â·Ð
VBA ¥Ø«e¦³­É´X¥»®Ñ¨Ó¬Ý
¥i¬O³Ì¦h³£¤¶²Ð´£¤É®Ä²vªº¤èªk
-
·Q½Ð°Ý¤@¤U ¦p¦ó ¥Î Excel ªº vba ¦Û°ÊÂà´«¦¨ ppt
¬O§_¯àÂà ? ÁÙ¬O¤£¯àÂà ?

½Ð¨D¤j¤j­Ì¹ï§Ú³o¦ìvba·s¤â¤¶²Ð¤@¤U
¼Ó¥D¼ö©«

¦^´_ 1# xperia0603
½Ð°Ñ¦Ò¥H¤Uvba
  1. Sub CreatePowerPoint()

  2. 'Add a reference to the Microsoft PowerPoint Library by:
  3.     '1. Go to Tools in the VBA menu
  4.     '2. Click on Reference
  5.     '3. Scroll down to Microsoft PowerPoint X.0 Object Library, check the box, and press Okay

  6.     'First we declare the variables we will be using
  7.         Dim newPowerPoint As PowerPoint.Application
  8.         Dim activeSlide As PowerPoint.Slide
  9.         Dim cht As Excel.ChartObject
  10.      
  11.      'Look for existing instance
  12.         On Error Resume Next
  13.         Set newPowerPoint = GetObject(, "PowerPoint.Application")
  14.         On Error GoTo 0
  15.      
  16.     'Let's create a new PowerPoint
  17.         If newPowerPoint Is Nothing Then
  18.             Set newPowerPoint = New PowerPoint.Application
  19.         End If
  20.     'Make a presentation in PowerPoint
  21.         If newPowerPoint.Presentations.Count = 0 Then
  22.             newPowerPoint.Presentations.Add
  23.         End If
  24.      
  25.     'Show the PowerPoint
  26.         newPowerPoint.Visible = True
  27.    
  28.     'Loop through each chart in the Excel worksheet and paste them into the PowerPoint
  29.         For Each cht In ActiveSheet.ChartObjects
  30.         
  31.         'Add a new slide where we will paste the chart
  32.             newPowerPoint.ActivePresentation.Slides.Add newPowerPoint.ActivePresentation.Slides.Count + 1, ppLayoutText
  33.             newPowerPoint.ActiveWindow.View.GotoSlide newPowerPoint.ActivePresentation.Slides.Count
  34.             Set activeSlide = newPowerPoint.ActivePresentation.Slides(newPowerPoint.ActivePresentation.Slides.Count)
  35.                
  36.         'Copy the chart and paste it into the PowerPoint as a Metafile Picture
  37.             cht.Select
  38.             ActiveChart.ChartArea.Copy
  39.             activeSlide.Shapes.PasteSpecial(DataType:=ppPasteMetafilePicture).Select
  40.    
  41.         'Set the title of the slide the same as the title of the chart
  42.             activeSlide.Shapes(1).TextFrame.TextRange.Text = cht.Chart.ChartTitle.Text
  43.             
  44.         'Adjust the positioning of the Chart on Powerpoint Slide
  45.             newPowerPoint.ActiveWindow.Selection.ShapeRange.Left = 15
  46.             newPowerPoint.ActiveWindow.Selection.ShapeRange.Top = 125
  47.         
  48.             activeSlide.Shapes(2).Width = 200
  49.             activeSlide.Shapes(2).Left = 505
  50.             
  51.         Next
  52.      
  53.     AppActivate ("Microsoft PowerPoint")
  54.     Set activeSlide = Nothing
  55.     Set newPowerPoint = Nothing
  56.      
  57. End Sub
½Æ»s¥N½X

TOP

¦^´_ 1# xperia0603
¦bÀ³¥Î genes ¼Ó¥Dªº CreatePowerPoint() ¨ç¥Ü®É¡A°O±o­n¥ý¶}±Ò
Microsoft PowerPoint 14.0 Object Library  (2007 ª©¥»¥H¤W)
¦pªG¤£ª¾¦p¦ó±Ò°Ê¡A½Ð¬Ý¥H¤U»¡©ú¡G

¶}µo¤H­û   --->   ³]©w¤Þ¥Î¶µ¥Ø   --->   ¤Ä¿ï
"Microsoft PowerPoint 14.0 Object Library"   --->  
½T©w¡C

TOP

ÁÂÁ³ᠠ´ú¸Õ¦¨¥\ ¥i¬O ¦pªG§Ú¤µ¤ÑEXCEL ¦³¹Ï¤ù or ¤å¦r ·Q¤@¨ÖÂà´« ·Q½Ð°Ý ¦³¤°»ò¤èªk©O

ÁÙ¦³ ¦p¦ó¾Ç²ß vba ªº Âà´«©O

TOP

¦^´_ 4# xperia0603


    ½Ðªþ¤WÀÉ®×

TOP

¦^´_ 5# genes


©êºp  ³Ìªñ¦£©ó¤@¨Ç¨Æ±¡ ¯ÔÀÁ¤F vbaªº¾Ç²ß

¥Ø«e¥d¦b  


°²³] §Ú¦³³o¨Ç¼Æ­È

100        101        102        103        104
200        201        202        203        204
300        301        302        303        304
400        401        402        403        404
500        501        502        503        504


¦p¦ó§Q¥Î vba §â³o¨Ç¼Æ­È Åܦ¨ ªø±ø¹Ï ¶ê»æ¹Ïµ¥ µM«á Âà´«¦¨ power point ¤W­±ªºpag©O¡H

TOP

¦^´_ 2# genes


    ±z¦n¡A°Ñ¦Ò±z©Ò´£¨Ñªº VBA¡A¹ï§Ú¨ü¯q¨}¦h¡C

    ·Q¦A¸ß°Ý¡A¹ï©ó¥ÑExcel VBA©Ò©ßÂà¥XªºpptÀɮסA¬O§_¯à¦p¦PEXCEL¤@¯ë¡A¦A³z¹LVBA¥i¦Û°Ê¦sÀɩάO«ü©w¨ì¬ÛÃö¸ô®|µ¥¤èªk¡C

TOP

        ÀR«ä¦Û¦b : ¨ü¤HÂI¤ô¤§®¦¡A¶··í´é¬u¥H³ø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD