Hi again!
I have a macro "CommandButton2_Click" assigned to a button a Sheet1
that can output the current date and time to a text file.
Another button on Sheet2 ("CommandButton4_Click") outputs the required data to the same text file.
So, how can I modify the 2nd macro, so that it will also export the date and time before exporting the required data to the text file?
I tried to use "Call" with the 2nd macro like this:
Code:
Private Sub CommandButton4_Click()
Call Sheet1.CommandButton2_Click
Dim FileName As String ' the file to write to
Dim DataRange As Range ' the range containing the data to export
Dim Append As Boolean ' whether to append or overwrite existing data
etc.
End If
End Sub