根据我的经验,打开包含未捕捉到单元格的图片对象的excel文件,往往会根据打开它的计算机而移动。
我想知道是否有办法绕过这种性质,比如用设定的分辨率参数打开excel文件?
我的利用率使用屏幕截图和单元格将粘贴的图片重新格式化为所需的大小。如:
dim rng as range
set shtemp=worksheets.add
Set rng = shtemp.[B14:Q49]
rng.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
shtemp.Shapes("Picture 1").Delete
Range("A1").Select
ActiveSheet.Paste
'Reset the altered cells to normal in order to maintain congruency in picture size alteration
'This line is where I have to re-adjust cell settings to match the computer/screen I am using and capture the needed range.
Rows("49:49").RowHeight = 13.2
Columns("Q").ColumnWidth = 8.11
Set r = Range("B5:T45")
With Selection.ShapeRange
.LockAspectRatio = False
.Top = r.Top
.Left = r.Left
.Width = r.Width
.height = r.height
End With
答案 0 :(得分:0)
尝试将此添加到代码中。它选择一个范围并将缩放调整到该范围。因此,无论excel表的大小如何,范围都适合窗口。使用范围大小和最终范围选择可以聚焦于工作表的正确部分。
Range("A1:S1").Select
ActiveWindow.Zoom = True
Range("B5").Select