View Single Post
 
Old 02-12-2013, 07:47 AM
Geza59 Geza59 is offline Windows XP Office 2003
Novice
 
Join Date: May 2012
Location: Budapest, Hungary
Posts: 20
Geza59 is on a distinguished road
Question How to run two button macros with one button?

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
Reply With Quote