View Single Post
  #8   Report Post  
Old February 8th 18, 11:17 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?

To implement InsertPictureFromFile requires no dependancy on the Forms lib nor
the clipboard...

Option Explicit

Sub InsertPictureFromFile()
'Inserts picture-from-file at the active cell
Dim sFile$

sFile = Get_FileToOpen: If sFile = "" Then Exit Sub
Selection.ShapeRange.ScaleHeight 0.85, msoFalse, msoScaleFromTopLeft
'Assumes the follow 'custom' toolbar exists
Application.CommandBars("Format Object").Visible = False
End Sub

Function Get_FileToOpen$(Optional FileTypes$)
If FileTypes = "" Then FileTypes = "All Files ""*.*"", (*.*)"

Dim vFile
vFile = Application.GetOpenFilename(FileTypes)
Get_FileToOpen = IIf(vFile = False, "", vFile)
End Function


Free usenet access at
Classic VB Users Regroup!