ryan_law2000
Well-known Member
- Joined
- Oct 2, 2007
- Messages
- 738
Hello Everyone I have VBA that embeds an object but I want to be able to set the size of it.
Any ideas how to change this from the size of a cell to actually enter in the values of size that I need?
I also want it to always display "FIELD TICKET" as the icon text but cant seem to make it work.
Thanks
Any ideas how to change this from the size of a cell to actually enter in the values of size that I need?
I also want it to always display "FIELD TICKET" as the icon text but cant seem to make it work.
Thanks
Code:
Sub AttachTicket()
Dim vFile As String
Dim objI As Object
Dim rngI As Range
For Each rngI In Range("J17") 'make range any size, or use Selection for flexibility
vFile = Application.GetOpenFilename("All Files,*.*", Title:="Find file to insert")
If LCase(vFile) = "false" Then Exit Sub
Set objI = ActiveSheet.OLEObjects.Add(Filename:=vFile, Link:=False, DisplayAsIcon:=True, IconLabel:=vFile)
objI.Left = rngI.Left
objI.Top = rngI.Top
objI.Height = rngI.Height
objI.Width = rngI.Width
'If objI.Height > rngI.Height Then
'objI.Height = rngI.Height
'End If
Next rngI
With Worksheets("Main").Range("K18")
.Value = "<-- Attached! Double Click to View"
End With
End Sub