插入的图像未显示在所需位置 [英] inserted Image is not displayed in the required position
本文介绍了插入的图像未显示在所需位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
将图片添加到Excel中特定单元格的形状时遇到一个奇怪的问题.
添加图片后,它不会在运行时显示在所需位置.但是在重新打开相同的Excel时,图像显示在正确的位置.此外,在调试时,我得到了所需的结果.我丢失了我在用Excel 2010
以下是我正在使用的代码段.
Hello all,
I have a weird problem while adding picture to shapes for a specific cell in Excel.
Once the picture is added, it is not being displayed at the required position at run time.But on re-opening the same excel, the image is appearing in the proper position.Also,on debugging i get the required result.Am i missing something here?Iam using Excel 2010
Below is the code snippet that i am using.
Dim shp As Shape
Dim PicRange As Range
Dim strCol As String
Dim strPicFileName As String
Dim varPath As Variant
Dim strPhotoName As String
strPhotoName = Cells(lngRow, SLDataCol.Photo_Link).Value
varPath = Application.Range("SLPicPath").Value & strPhotoName
strCol = "D" 'Image to be shown
Set PicRange = Range(strCol & lngRow & ":" & strCol & lngRow)
Set shp = shtSL.Shapes.AddPicture(Filename:=varPath _
, LinkToFile:=False, SaveWithDocument:=True, Left:=PicRange.Left, Top:=PicRange.Top, Width:=160, Height:=68)
shtSL.Rows(lngRow & ":" & lngRow).Select
Selection.RowHeight = 70
shp.ControlFormat.PrintObject = True
shp.Placement = xlMoveAndSize
Set PicRange = Nothing
Set shp = Nothing
推荐答案
尝试使用 Application.ScreenUpdating [ ^ ]属性:
Try to use Application.ScreenUpdating[^] property:
Application.ScreenUpdating=False
'your code
Application.ScreenUpdating=True
这篇关于插入的图像未显示在所需位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文