muhammad susanto
Well-known Member
- Joined
- Jan 8, 2013
- Messages
- 2,102
- Office Version
- 365
- 2021
- Platform
- Windows
hi all.
i have macro code to insert picture from a folder. The code work properly.
i have problem, after running code the pict is displayed but then when save the file then the new file opened the other device/pc/notebook the picture not "show " and show message "The linked image cannot be displayed. The file may have been moved, renamed or deleted. Verify that the link points to the correct file and location."
I need the code to be able to save the picture within the file itself. Here is the code for the macro:
maybe this link related can solve my problem
how to fix it the problem and maybe modified my code above.
any help, greatly appreciated..
note I'm use Office 2010
.sst
i have macro code to insert picture from a folder. The code work properly.
i have problem, after running code the pict is displayed but then when save the file then the new file opened the other device/pc/notebook the picture not "show " and show message "The linked image cannot be displayed. The file may have been moved, renamed or deleted. Verify that the link points to the correct file and location."
I need the code to be able to save the picture within the file itself. Here is the code for the macro:
VBA Code:
Sub InsertPicture_r2()
Const cBorder As Double = 5 ' << change as required
Dim sPicture As String, pic As Picture
sPicture = Application.GetOpenFilename("Pictures (*.gif; *.jpg; *.bmp; *.tif), *.gif; *.jpg; *.bmp; *.tif", , "Select Picture to Import")
If sPicture = "False" Then Exit Sub
Set pic = ActiveSheet.Pictures.Insert(sPicture)
With pic
.ShapeRange.LockAspectRatio = False ' << change as required
If Not .ShapeRange.LockAspectRatio Then
.Width = ActiveCell.MergeArea.Width - (2 * cBorder)
.Height = ActiveCell.MergeArea.Height - (2 * cBorder)
Else
If .Width >= .Height Then
.Width = ActiveCell.MergeArea.Width - (2 * cBorder)
Else
.Height = ActiveCell.MergeArea.Height - (2 * cBorder)
End If
End If
.Top = ActiveCell.MergeArea.Top + cBorder
.Left = ActiveCell.MergeArea.Left + cBorder
.Placement = xlMoveAndSize
End With
Set pic = Nothing
End Sub
Excel 2010 Macro Changes? - Microsoft: Office
Was wondering if the macro coding has changed in the 2010 version of Excel. We have a workbook with several macros in it. A few of these macros are for adding pictures to the workbook. The code in the macros works for Excel 2003 and 2007, but doesn't do as it should in 2010. The problem we are...
www.tek-tips.com
any help, greatly appreciated..
note I'm use Office 2010
.sst