View Single Post
  #7   Report Post  
Old February 8th 18, 10:32 PM posted to microsoft.public.excel.misc
GS[_6_] GS[_6_] is offline
external usenet poster
 
First recorded activity by ExcelBanter: Apr 2015
Posts: 981
Default Pasting text into VBA macro?

Try...

Option Explicit


Sub InsertPicture_Gf4()
'Insert a picture at the active cell
ActiveCell.Pictures.Insert(Get_ClipboardText).Sele ct
Selection.ShapeRange.ScaleHeight 0.85, msoFalse, msoScaleFromTopLeft
Application.CommandBars("Format Object").Visible = False
Rows("27:27").Select
End Sub

Private Function Get_ClipboardText$()
' Requires a ref to Microsoft Forms 2.0 Library

Dim doData As New DataObject
On Error Resume Next
doData.GetFromClipboard: Get_ClipboardText = doData.GetText
Set doData = Nothing
End Function

...but why use ME? Why not browse for a specific file same as
InsertPictureFromFile does?

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion