Hello I need help with a VBA code.
I am currently using the below code to save files to the correct folders.
Sub Button1_Click()
Dim Path As String
Dim filename As String
Dim filename2 As String
Dim country As String
Dim Fixpath As String
filename = Range("J3")
filename2 = Range("J4")
country = Range("J5")
Fixedpath = "L:\FINANCE\Aug 18"
If country = "GB" Then
Path = "UK"
ElseIf country = "DE" Then
Path = "CE"
ElseIf country = "FS" Then
Path = "FR"
ElseIf country = "NO" Then
Path = "Nordics"
ElseIf country = "SE" Then
Path = "Nordics"
End If
ActiveWorkbook.SaveAs filename:=Fixedpath & Path & filename & filename2 & ".xls", FileFormat:=xlNormal
End Sub
The next step would be to attach workbook to an email addressing a company based on the company code.
Company code: FR
Email Addressed to: Query@Francetech.com
Can this be done or would I need to create a separat macro.
Kind Regards
Hanz
I am currently using the below code to save files to the correct folders.
Sub Button1_Click()
Dim Path As String
Dim filename As String
Dim filename2 As String
Dim country As String
Dim Fixpath As String
filename = Range("J3")
filename2 = Range("J4")
country = Range("J5")
Fixedpath = "L:\FINANCE\Aug 18"
If country = "GB" Then
Path = "UK"
ElseIf country = "DE" Then
Path = "CE"
ElseIf country = "FS" Then
Path = "FR"
ElseIf country = "NO" Then
Path = "Nordics"
ElseIf country = "SE" Then
Path = "Nordics"
End If
ActiveWorkbook.SaveAs filename:=Fixedpath & Path & filename & filename2 & ".xls", FileFormat:=xlNormal
End Sub
The next step would be to attach workbook to an email addressing a company based on the company code.
Company code: FR
Email Addressed to: Query@Francetech.com
Can this be done or would I need to create a separat macro.
Kind Regards
Hanz