View Single Post
  #8   Report Post  
Old February 8th 18, 10: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: 1,001
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
ActiveSheet.Pictures.Insert(sFile).Select
Selection.ShapeRange.ScaleHeight 0.85, msoFalse, msoScaleFromTopLeft
'Assumes the follow 'custom' toolbar exists
Application.CommandBars("Format Object").Visible = False
Rows("27:27").Select
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

--
Garry

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