im wanting a button/macro that when pressed will auto save as the workbook, combining data from two cells on the work sheet.
the code ive wrote, brings a pop up box with "400" wrote in it and the options of ok and help (help doesnt help!)
Sub Button1_Click()
Dim Char As Variant
Dim FilePath As String
Dim FileType As String
Dim NewName As String
FileType = ".xlsx"
For Each Char In Array("<", ">", "?", "/", "\", ":", "*", """")
Ans = Replace(Ans, Char, "_")
Next Char
NewName = [f4] & "-" & [f3]
If InStrRev(Ans, ".") = 0 Then NewName = NewName & FileType
ChDir _
"C:\"
ActiveWorkbook.SaveAs Filename:=NewName
End Sub
can any body who knows more about this than me point out where im going wrong?
the code ive wrote, brings a pop up box with "400" wrote in it and the options of ok and help (help doesnt help!)
Sub Button1_Click()
Dim Char As Variant
Dim FilePath As String
Dim FileType As String
Dim NewName As String
FileType = ".xlsx"
For Each Char In Array("<", ">", "?", "/", "\", ":", "*", """")
Ans = Replace(Ans, Char, "_")
Next Char
NewName = [f4] & "-" & [f3]
If InStrRev(Ans, ".") = 0 Then NewName = NewName & FileType
ChDir _
"C:\"
ActiveWorkbook.SaveAs Filename:=NewName
End Sub
can any body who knows more about this than me point out where im going wrong?