Caleeco
Well-known Member
- Joined
- Jan 9, 2016
- Messages
- 980
- Office Version
- 2010
- Platform
- Windows
Hello,
I'm trying to write a piece of code that will insert a local .png picture into a cell location in Excel. However, the twist is, this is for Mac 2011 Excel!
So this code, will work on Windows.. but not Mac. It falls over at the .Insert method.
From what I've read, Macs work slightly different. This syntax is wha ive seen online.
Any ideas how to get this working? Its hard for me to test as i dont have a mac
Many Thanks
Caleeco
I'm trying to write a piece of code that will insert a local .png picture into a cell location in Excel. However, the twist is, this is for Mac 2011 Excel!
So this code, will work on Windows.. but not Mac. It falls over at the .Insert method.
Code:
<code class="prettyprint prettyprinted" style="box-sizing: border-box; padding: 0px; font-size: inherit; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; color: inherit; border-radius: 0px; white-space: pre-wrap; background-color: transparent;">
</code>SubAddSignature()
Application.ScreenUpdating = False
Dim SigPath As String
Dim tSigFile As String
Dim tSig As String
With Worksheets("Macro Variables") 'ReadInputVariables(FilePath&FileName)
SigPath=.Range("D7").Value
tSigFile =.Range("D10").Value
EndWith
tSig =SigPath& tSigFile 'Concatenate File Path & File Names
Worksheets("Timesheet").Range("G27:H27").Select 'Define range to place img
ActiveSheet.Pictures.Insert(tSig)
Application.ScreenUpdating=True
EndSub<code class="prettyprint prettyprinted" style="box-sizing: border-box; padding: 0px; font-size: inherit; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; color: inherit; border-radius: 0px; white-space: pre-wrap; background-color: transparent;"></code>
From what I've read, Macs work slightly different. This syntax is wha ive seen online.
Code:
Dim pasteCell as range
Dim theShape as Shape
Worksheets("Timesheet").Range("G27:H27").Select 'Define range to place img
set pasteCell =Worksheets("Timesheet").Range("G27")
pasteCell.Select
Set theShape =Worksheets("Timesheet").Shapes.AddPicture("FILEPATH HERE", pasteCell.Left, pasteCell.Top,200,200)
Any ideas how to get this working? Its hard for me to test as i dont have a mac
Many Thanks
Caleeco