I attached this macro:
Sub setPayPeriodDate Dim selection as Integer selection = MsgBox("",4 + 128,"Change to the next pay period?") If selection = 6 then Dim timeCard : timeCard = ThisComponent.Sheets.getByName("Chris") 'Note you need to substitute the name of your sheet if you have renamed it. Dim dateCell Dim currentDate As Date ' Get current pay period's start date dateCell = timeCard.getCellByPosition(0,2) currentDate = dateCell.getValue() ' Change date to beginning of next pay period dateCell.setValue(currentDate + 14) End If End Sub
to the OnPrint event. When I initiate the print, the expected Yes/No dialogue pop-up appears. but clicking either button does not close the dialogue box. Clicking a button again closes the dialogue and prints the document. Problem is, clicking the ‘Yes’ button twice, updates the cell twice. Why?