Results 1 to 24 of 24

.Shapes.PasteSpecial(Link:=True) from Excel Range to ppt fails

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    08-07-2014
    Location
    Quito, Ecuador
    MS-Off Ver
    Excel 2016 & 365, Windows 10
    Posts
    511

    .Shapes.PasteSpecial(Link:=True) from Excel Range to ppt fails

    Hi everybody

    I'm trying to copy a range from a worksheet, and paste it "Linked to the source".
    I have a Power Point file with 2 blank slides named Test.pptx

    The partial code I post here copies a first range and pastes it by default conditions, and goes OK
    the second range, I try to paste and link to the source, but I only get error
    I've tried diferent options I found over the web, but no one works.

    It must be something simple I'm mistaking.


    Sub CopyToPpt()
    
    Dim PPt As PowerPoint.Application
    Dim mySlide As PowerPoint.Slide
    
    Set PPt = New PowerPoint.Application
    PPt.Visible = True
    PPt.Presentations.Open Filename:="C:\Users\vp\Desktop\Test.pptx"
    
    Set mySlide = PPt.ActivePresentation.Slides(1)
    mySlide.Select
    Sheets("Hoja1").Range("B2:E5").Copy
    mySlide.Shapes.Paste
    Set myForm = mySlide.Shapes(mySlide.Shapes.Count)
    myForm.Left = 50
    myForm.Top = 150
    Application.CutCopyMode = False
    
    
    PPt.Visible = True
    Set mySlide = PPt.ActivePresentation.Slides(2)
    mySlide.Select
    Sheets("Hoja2").Range("B6:E15").Copy
    mySlide.Shapes.PasteSpecial(Link:=True).Select 'Here is the error message
    Set myForm = mySlide.Shapes(mySlide.Shapes.Count)
    myForm.Left = 50
    myForm.Top = 150
    
    Set PPt = Nothing
    Set mySlide = Nothing
    End Sub
    Your help will be very appreciated
    Last edited by vichopalacios; 12-12-2016 at 05:37 PM.
    Barriers are there for those who don't want to dream

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Run-time error on shapes.visible=true macro
    By djagxk8 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-02-2016, 03:27 PM
  2. Workbooks.Open (Readonly:= true) fails at random times
    By wannabeNerd in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-30-2015, 03:53 AM
  3. [SOLVED] ws.Paste method fails after lots of copy-paste of shapes
    By bagullo in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-15-2015, 03:00 AM
  4. [SOLVED] Condensing ActiveSheet.Shapes().Visible=True
    By eculver in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-15-2013, 07:52 PM
  5. REQUEST: Macro to Link Excel Cell to Shapes
    By MBCMDR in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-29-2011, 05:21 AM
  6. [SOLVED] PasteSpecial of range class failed in Excel 2003
    By Sachin Vaishnav in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-21-2006, 02:35 AM
  7. Shapes.visible = false/true
    By Ctech in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-22-2006, 10:30 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1