Hi All,
I am new to VBa coding i managed to code two buttons. now i have been struggling how to merge their codes.
this are my 2 codes:
Dim myWB As Excel.Workbook
Private Sub cmdUpdtAmt_Click()
Set myWB = GetObject("G:\test\ExcelCalculation.xlsm")
Selection.GoTo What:=wdGoToBookmark, Name:="AmtDue"
Selection.TypeText (myWB.Sheets("PayHist").Range("Amount_Due"))
Set myWB = Nothing
End Sub
Private Sub cmdUpdtTime_Click()
Set myWB = GetObject("G:\test\ExcelCalculation.xlsm")
Selection.GoTo What:=wdGoToBookmark, Name:="DaysOverdue"
Selection.TypeText (myWB.Sheets("PayHist").Range("Payment_Overdue"))
Set myWB = Nothing
End Sub
my purpose is to assign these two codes to just one button ...
Thank you very much for your help
I am new to VBa coding i managed to code two buttons. now i have been struggling how to merge their codes.
this are my 2 codes:
Dim myWB As Excel.Workbook
Private Sub cmdUpdtAmt_Click()
Set myWB = GetObject("G:\test\ExcelCalculation.xlsm")
Selection.GoTo What:=wdGoToBookmark, Name:="AmtDue"
Selection.TypeText (myWB.Sheets("PayHist").Range("Amount_Due"))
Set myWB = Nothing
End Sub
Private Sub cmdUpdtTime_Click()
Set myWB = GetObject("G:\test\ExcelCalculation.xlsm")
Selection.GoTo What:=wdGoToBookmark, Name:="DaysOverdue"
Selection.TypeText (myWB.Sheets("PayHist").Range("Payment_Overdue"))
Set myWB = Nothing
End Sub
my purpose is to assign these two codes to just one button ...
Thank you very much for your help