DEV Community

Oscar Sun(孫守真字任真)
Oscar Sun(孫守真字任真)

Posted on

Answer: how to check if word document has printed already

How about this? https://stackoverflow.com/a/76738547/8249058 Use BackgroundPrintingCount property to implement.

Sub Testing()
    Dim hasPrinted As Boolean, BackgroundPrintingCount As Integer
    BackgroundPrintingCount = Word.Application.BackgroundPrintingStatus
    ActiveDocument.PrintOut
    While Word.Application.BackgroundPrintingStatus > BackgroundPrintingCount
        hasPrinted = False
    Wend
    hasPrinted = True
    If hasPrinted = True Then
        'call code here...
    Else
        hasPrinted = False
        MsgBox "Please Print Before Adding"

Top comments (0)