Solved

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

Posted on 2014-07-28
6
199 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 48

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 48

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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 9

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 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

18 Experts available now in Live!

Get 1:1 Help Now