
Convert VBA (excel macro) to Mac OSX (excel 2011)
- or -
Post a project like this4772
$$
- Posted:
- Proposals: 1
- Remote
- #257180
- Awarded
Description
Experience Level: Intermediate
Hi there... I have to switch below VBA macro from PC platform to Mac OSX (excel 2011) or write a new one. Target it to paste a picture to the next cell from selection.
PC version:
Sub Paste_picture_to_next_cell()
Dim Filename$, place As Range, myPic As Object, kom$
For Each place In Selection
kom = place.Offset(, 1).Address
Filename = "D:\offer\items pictures\" & place
If FileExists(Filename & ".jpg") = True Then
Set myPic = ActiveSheet.Pictures.Insert(Filename & ".jpg")
With myPic
.Top = Range(kom).Top
.Left = Range(kom).Left
.ShapeRange.LockAspectRatio = msoFalse
.ShapeRange.Height = Range(kom).RowHeight
.ShapeRange.Width = Range(kom).Width
End With
End If
Next
Set myPic = Nothing
End Sub
Public Function FileExists(FilePath As String) As Boolean
On Error GoTo blad
FileExists = Len(Dir(FilePath, vbDirectory Or vbHidden Or vbSystem)) > 0
Exit Function
error:
FileExists = False
End Function
PC version:
Sub Paste_picture_to_next_cell()
Dim Filename$, place As Range, myPic As Object, kom$
For Each place In Selection
kom = place.Offset(, 1).Address
Filename = "D:\offer\items pictures\" & place
If FileExists(Filename & ".jpg") = True Then
Set myPic = ActiveSheet.Pictures.Insert(Filename & ".jpg")
With myPic
.Top = Range(kom).Top
.Left = Range(kom).Left
.ShapeRange.LockAspectRatio = msoFalse
.ShapeRange.Height = Range(kom).RowHeight
.ShapeRange.Width = Range(kom).Width
End With
End If
Next
Set myPic = Nothing
End Sub
Public Function FileExists(FilePath As String) As Boolean
On Error GoTo blad
FileExists = Len(Dir(FilePath, vbDirectory Or vbHidden Or vbSystem)) > 0
Exit Function
error:
FileExists = False
End Function
Jaroslaw P.
0% (0)Projects Completed
1
Freelancers worked with
1
Projects awarded
100%
Last project
7 Jun 2013
United States
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies