title: How to create a powerpoint table using powershell
body: <p>I'm currently trying to create a calendar in powerpoint using powershell. All I want to do is <strong>insert a table into a powerpoint slide.</strong> This table is representing the month of January, it contains the days of the week etc.</p>
  
  <p>I did some research and came across <a href="http://blogs.technet.com/b/heyscriptingguy/archive/2007/10/16/how-can-i-copy-data-from-excel-to-powerpoint.aspx?Redirected=true" rel="nofollow" title="this is what i found">this</a>.</p>
  
  <p>This is VB script, so i tried to "create its equivalent" in powershell:</p>
  
  <p><strong>EDIT3:</strong> I was finally able to copy my table from Excel and paste it into my powerpoint slide using this code:</p>
  
  <pre><code>#Create an instance of Excel.
  $xl=New-Object -ComObject "Excel.Application"
  $xl.Visible = $True
  
  #Open the Excel file containing the table. 
  $wb = $xl.workbooks.open("C:\January.xls")
  $ws = $wb.ActiveSheet
  
  #Select the table.
  $range = $ws.range("A1:G7")
  $range.select()
  
  #Copy the table to the clipboard.
  $range.copyPicture()
  
  #Create an instance of Powerpoint.
  $objPPT = New-Object -ComObject "Powerpoint.Application"
  $objPPT.Visible ='Msotrue'
  
  #Add a slide to the presentation.    
  $project = $objPPT.Presentations.Add()
  $slide  = $project.Slides.Add(1, 1)
  
  #Paste the table into the slide.
  $shape = $slide.Shapes.Paste()
  
  #Position the table.
  $shape.Left = 50
  $shape.Top = 150
  $shape.Width = 300
  $shape.Height = 168
  </code></pre>
  
  <p>Thanks to those who have helped me here and on #powershell</p>