VBA/Excel/Access/Word/Excel/ExecuteExcel4Macro

Материал из VB Эксперт
Перейти к: навигация, поиск

Application.ExecuteExcel4Macro

 
Sub Macro1_Version4()
    Dim St As String
    St = "PAGE.SETUP(, , " & _
                     "1.5, 1.5, 1.5, 1.5" & _
                     ", 0, False, False, False, 1, 1, True, 1, 1,False, , " & _
                     "1, 1" & _
                     ", False)"
    Application.ExecuteExcel4Macro St
End Sub



Determining the number of printed pages

 
Sub ShowPageCount()
    For Each sht In Worksheets
        sht.Activate
        Pages = ExecuteExcel4Macro("Get.Document(50)")
        Debug.Print Pages
    Next sht
End Sub