rhino4eva
Active Member
- Joined
- Apr 1, 2009
- Messages
- 262
- Office Version
- 2010
- Platform
- Windows
Sub SaveEngine(sFileNum As String)
StrDate = Format(Now(), "dd-mmm-yyyy")
RunNum = Sheets("Sheet1").Range("e3").Value
Sheets("ABI-" & sFileNum).SaveAs Filename:=FileLoc & "\RESP ABI\ABI-Resp " & sFileNum & " " & StrDate & " " & RunNum & ".txt", FileFormat:=xlTextMSDOS, CreateBackup:=False
MsgBox "File saved as : " & FileLoc & "\RESP ABI\ABI-Resp " & sFileNum & " " & StrDate & " " & RunNum & ".txt"
Err.Clear
End Sub
------------------------------------------------------------------------------------------------
Sub NETWORK()
If Sheets("DATA").Range("D1").Value < 22 Then
Call SaveEngine("1PLATE")
End If
If Sheets("DATA").Range("D1").Value > 21 Then
Call SaveEngine("Flu&Sw")
Call SaveEngine("RSV&PF")
End If
End Sub
-----------------------------------------------------------------------------------------------------
!userform!
Option Explicit
Dim FileLoc As String
--------------------------------------
Private Sub CommandButton1_Click()
FileLoc = "F:"
Call NETWORK
End Sub
---------------------------------------
Private Sub CommandButton2_Click()
FileLoc = "Z:"
Call NETWORK
End Sub
---------------------------------------
as you can see i have 3 bits of code i am tying to staple together.
1) is the save engine so i can do the same task once or twice dependant the number of entries on DATA
2) is the fuel area for the engine that decides file filenames and sheet names to use
3) although this is the last bit it actually is a user based decision userform that pick which device to save to
no matter how i try i cant the FileLoc variable form the userform to work in the SaveEngine area of the code
i know i must me missing something ...but what !!!!!
StrDate = Format(Now(), "dd-mmm-yyyy")
RunNum = Sheets("Sheet1").Range("e3").Value
Sheets("ABI-" & sFileNum).SaveAs Filename:=FileLoc & "\RESP ABI\ABI-Resp " & sFileNum & " " & StrDate & " " & RunNum & ".txt", FileFormat:=xlTextMSDOS, CreateBackup:=False
MsgBox "File saved as : " & FileLoc & "\RESP ABI\ABI-Resp " & sFileNum & " " & StrDate & " " & RunNum & ".txt"
Err.Clear
End Sub
------------------------------------------------------------------------------------------------
Sub NETWORK()
If Sheets("DATA").Range("D1").Value < 22 Then
Call SaveEngine("1PLATE")
End If
If Sheets("DATA").Range("D1").Value > 21 Then
Call SaveEngine("Flu&Sw")
Call SaveEngine("RSV&PF")
End If
End Sub
-----------------------------------------------------------------------------------------------------
!userform!
Option Explicit
Dim FileLoc As String
--------------------------------------
Private Sub CommandButton1_Click()
FileLoc = "F:"
Call NETWORK
End Sub
---------------------------------------
Private Sub CommandButton2_Click()
FileLoc = "Z:"
Call NETWORK
End Sub
---------------------------------------
as you can see i have 3 bits of code i am tying to staple together.
1) is the save engine so i can do the same task once or twice dependant the number of entries on DATA
2) is the fuel area for the engine that decides file filenames and sheet names to use
3) although this is the last bit it actually is a user based decision userform that pick which device to save to
no matter how i try i cant the FileLoc variable form the userform to work in the SaveEngine area of the code
i know i must me missing something ...but what !!!!!