2017-07-27 130 views
1

我的经验,打开包含未捕捉到一个细胞画面对象Excel文件往往游移,这取决于它在被打开的电脑上。VBA调整屏幕分辨率

我在想,如果有一种解决这种性质的方法,例如用设置的分辨率参数打开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

尝试将此代码添加到代码中。它选择一个范围,并将缩放比例调整到该范围。所以,无论Excel表的大小如何,范围都可以放在窗口内。在范围大小和最终范围选项中进行调整以关注纸张的正确部分。

Range("A1:S1").Select 
ActiveWindow.Zoom = True 
Range("B5").Select