title: Access Error: Object variable or With block variable not set (Error 91)
body: <p>I Know similar questions have been asked, but I still can't figure out this error.</p>
  
  <p>I am working in Access, exporting to excel and used some excel macros to format the data and create charts. I am now trying to put those charts into a Powerpoint, and I am having trouble pasting only one of the four charts I am trying to copy over.</p>
  
  <p>My code to export the third and fourth charts is as follows:</p>
  
  <pre><code>          xl.Sheets("Sheet with chart 3").Select
            Set rng = xl.ActiveChart
            rng.CopyPicture
            mySlide.Shapes.PasteSpecial DataType:=ppPasteEnhancedMetafile
            Set myShapeRange = mySlide.Shapes(mySlide.Shapes.Count)
              myShapeRange.Left = 365
              myShapeRange.Top = 200
              myShapeRange.Width = 345
  
            xl.Sheets("Sheet with chart 4").Select
            Set rng = xl.ActiveChart
            rng.CopyPicture
            mySlide.Shapes.PasteSpecial DataType:=ppPasteEnhancedMetafile
            Set myShapeRange = mySlide.Shapes(mySlide.Shapes.Count)
              myShapeRange.Left = 365
              myShapeRange.Top = 200
              myShapeRange.Width = 345
  </code></pre>
  
  <p>I get the error "Object variable or With block variable not set (Error 91)" on the second occurrence of the line</p>
  
  <pre><code>rng.CopyPicture
  </code></pre>
  
  <p>So why would this code fail after running three times prior? I believe I qualified everything correctly, and this code isn't running inside a with block either. Also, The excel sheet it is pulling from is practically identical to the others.</p>