Here is one of the buttons. If you want me to post all the code for all the buttons let me know, it will take a lot of space. This button takes about 20-30 seconds to run (as it connects to a server and retrieves files). I want to disable all the other buttons (four) in my form while this is running and then enable them after the macro has finished.
Thanks!
Private Sub CommandButton1_Click()
ip = InputBox("Please enter IP")
user_name = InputBox("Please enter User Name")
pwd = InputBox("Please enter Password")
line_num = 0
Count = 0
Open "C:\TEST.bat" For Output As #1
Print #1, "ftp -s:C:\TEST.txt " & ip & " > C:\log.txt"
Close #1
Open "C:\TEST.txt" For Output As #2
Print #2, user_name
Print #2, pwd
Print #2, "cd /space/dbbackup/Daily/"
Print #2, "ls"
Print #2, "bye"
Close #2
retval = Shell("C:\TEST.bat", 1)
Application.Wait Now + TimeValue("00:00:05")
Open "C:\log.txt" For Input As #3
Do While Not EOF(3)
Line Input #3, textline
line_num = line_num + 1
Loop
Close #3
Application.Wait Now + TimeValue("00:00:05")
Open "C:\log.txt" For Input As #4
For Count = 0 To line_num - 7
Line Input #4, textline1
Next Count
Close #4
Application.Wait Now + TimeValue("00:00:05")
Open "C:\TEST1.txt" For Output As #6
Print #6, user_name
Print #6, pwd
Print #6, "cd /space/dbbackup/Daily/" & textline1 & "/bulk/SystemConfiguration/"
Print #6, "get systemconfiguration_spatial.MSFICONSPANCONFIG.bulk"
Print #6, "get systemconfiguration_spatial.MSFICONGRPCONFIG.bulk"
Print #6, "bye"
Close #6
Open "C:\TEST1.bat" For Output As #5
Print #5, "cd c:\"
Print #5, "ftp -s:C:\TEST1.txt " & ip & " > C:\log1.txt"
Print #5, "move systemconfiguration_spatial.MSFICONSPANCONFIG.bulk c:\Temp\"
Print #5, "move systemconfiguration_spatial.MSFICONGRPCONFIG.bulk c:\Temp\"
Close #5
retval = Shell("C:\TEST1.bat", 1)
Application.Wait Now + TimeValue("00:00:5")
Kill "c:\log.txt"
Kill "c:\log1.txt"
Kill "c:\TEST.txt"
Kill "c:\TEST.bat"
Kill "c:\TEST1.txt"
Kill "c:\TEST1.bat"
End Sub