Solved

what is the vba command for "Paste Special Microsoft Visio Drawing Object" Using PowerPoint 2010

Posted on 2014-07-28
6
217 Views
Last Modified: 2014-12-16
I am attempting to write a Macro in PowerPoint 2010 that allows me to Paste Special a selected Microsoft Visio Drawing Object.  I have been unable to find the VBA command that simulates this option available in the Paste Special.
0
Comment
Question by:dbfc
  • 3
  • 2
6 Comments
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 40224467
Hi,

pls try

ActiveWindow.View.PasteSpecial DataType:=ppPasteOLEObject, Link:=msoFalse

Regards
0
 

Author Comment

by:dbfc
ID: 40227622
Already tried...does not provide the same result as  Paste Special "Microsoft Visio Drawing Object" available from the Paste Special options.
0
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 40228459
Pls try to record the same action in Excel

Then we will be able to adapt it to PPT

You should get something like this (I suppose)

ActiveSheet.PasteSpecial Format:="Microsoft Visio Document" _
        , Link:=False, DisplayAsIcon:=False

Regards
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

Accepted Solution

by:
dbfc earned 0 total points
ID: 40236128
Thanks for your suggestion but I ended up finding the following solution that resolved my issue.

ActiveWindow.View.PasteSpecial ppPasteEnhancedMetafile, msoFalse
0
 
LVL 10

Expert Comment

by:Jamie Garroch
ID: 40469412
This might help too. EMF objects can be usefully converted to native Microsoft Drawing objects which can then be edited in PowerPoint (and other MSO apps).

' =====================================================================
' Macro written by Jamie Garroch of http://youpresent.biz
' =====================================================================
' Pastes a vector based object from the clipboard to the current slide,
' converts it to a native MS Drawing objetc and then ungroups it to
' individual shapes.
' =====================================================================
' Function Parameters
'
'   Convert = True will convert the pasted object to an MS Drawing
'             object and then ungroup it to its component shapes
' =====================================================================
' Function Return : the pasted ShapeRange
' =====================================================================

Option Explicit

Public Function PasteEMFtoSlideShapes(Optional Convert As Boolean) As ShapeRange
  On Error GoTo errorhandler
  Dim oShpRng As ShapeRange
  
  ' Paste the clipboard object as a vector in EMF format
  Set oShpRng = ActivePresentation.Slides(ActiveWindow.View.Slide.SlideIndex).Shapes.PasteSpecial(ppPasteEnhancedMetafile, msoFalse)
  If Convert Then
    With oShpRng(1)
      ' Ungroup to convert to Microsoft Drawing Object
      .Ungroup.Select
      ' Now ungroup a second time to get the component shapes
      ActiveWindow.Selection.ShapeRange.Ungroup
    End With
  End If
  
  Set PasteEMFtoSlideShapes = oShpRng
  
  ' Clean up
  Set oShpRng = Nothing
Exit Function

errorhandler:
  MsgBox "An error occured:" & vbCrLf & vbCrLf & Err & " : " & Err.Description, vbCritical + vbOK, "VBA Macro Error"
  Err.Clear
  Set oShpRng = Nothing
End Function

Open in new window

0
 

Author Closing Comment

by:dbfc
ID: 40502209
It was the easiest solution to implement.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now