使用Excel宏截取屏幕截图

时间:2017-11-13 10:03:29

标签: excel-vba vba excel

Sub google()
    Set objIE = CreateObject("InternetExplorer.Application")
    WebSite = "www.google.com"
    With objIE
        .Visible = True
        .navigate WebSite
        Do While .Busy Or .readyState <> 4
            Application.SendKeys "({1068})", True
            DoEvents
        Loop
        AppActivate "Internet Explorer"
        ActiveSheet.Paste

        Dim shp As Shape
        With ActiveSheet
            Set shp = .Shapes(.Shapes.Count)
        End With
        shp.Height = 600
        shp.Width = 800
        .Document.Forms(0).Submit
        '.Quit
    End With
End Sub

我正在使用此代码使用Excel VBA宏截取屏幕截图。但是,此代码将截取我的整个屏幕截图。我需要一个网页的截图。有人可以帮我这个吗?

1 个答案:

答案 0 :(得分:3)

PrtSc 截取整个桌面的截图。要截取当前应用程序窗口的屏幕截图,请使用 Alt + PrtSc

Application.SendKeys "%{1068}", True