LoadPicture workaround for Excel 2011 VBA for Mac

D

Drew

Hi
After many hours of experimenting myself and reading Ron DeBruin's
website, I have a possible workaround for LoadPicture, which doesn't
work on the Mac version of Excel. It involves using the following
insert command.

ActiveSheet.Pictures.Insert (PicName & ".jpg")

I can supply more details if you are desperate.
 
K

khulik13

Hello, I am having this problem too and am desperately looking for a fix and or workaround for a programming class. This is the applicable part of my code, I'm trying to take a graph that I have plotted on my sheet and uploadit as a gif into a picture box on my user form. Any help would be appreciated,

Thanks,

Kevin

'put valujes in sheet
For i = 0 To N
Cells(i + 1, 1) = t(i)
Cells(i + 1, 2) = y(i)
Next

For i = 1 To ActiveSheet.ChartObjects.Count
ActiveSheet.ChartObjects(1).Delete
Next

'create a new chart
ActiveSheet.ChartObjects.Add(300, 100, 500, 300).Select
ActiveChart.ChartType = xlXYScatter

'plot graph
ActiveChart.SetSourceData Source:=ActiveSheet.Range(Cells(1, 1), Cells(N + 1, 2)), PlotBy:=xlColumns
ActiveChart.Legend.Select
Selection.Delete

'load graph to userform
ActiveChart.Export Filename:="/Users/khulik/Desktop tempchart123123.gif", FilterName:="GIF"
solutionimage.Picture = LoadPicture("/Users/khulik/Desktop tempchart123123.gif")


End Sub
 
Joined
Nov 12, 2014
Messages
1
Reaction score
0
Hello,

Can you help me run this code on Excel for Mac (2011)? I have error 1004... On Windows (Office 2010) everything is OK.

Sub Wstaw_Obraz()
Dim target As Range
Dim Pic As Object
Sheets("druk").Select
Set target = Range("H7")


If Range("G7").Value = 1 Then
Set Pic = ActiveSheet.Pictures.Insert("URL")
ElseIf Range("G7").Value = 2 Then
Set Pic = ActiveSheet.Pictures.Insert("URL")
End If

If Not Pic Is Nothing Then
Pic.Top = target.Top
Pic.Left = target.Left
Pic.Width = target.Width ' dopasowuje do wielkosci komorki
Pic.Height = 36 'dopasowuje do wielkosci komorki
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top