cchristner
12-13-2016, 10:24 PM
Hey guys,
I was wondering if anyone knew a way to save a file to a different folder based on the part number in B1? I want to create a folder for each part number and have the file save to that folder that is the same as the current part number in B1. Here is my current save code. it saves the file as a read only copy as the part number in B1 also with a time date stamp. Any help would be greatly appreciated. Thank you.
{Sub Save()
Dim Path As String
Dim FileName1 As String
Dim DateTime As String
Dim PathAndFileName As String
Path = "C:Libraries\Documents\"
If Range("B1").Value = "" Then
MsgBox "You Must Put a Value in Cell B1!"
Exit Sub
End If
FileName1 = Range("B1")
DateTime = " (" & Format(Now, "yyyy-mm-dd hhmm AMPM") & ").xlsm"
PathAndFileName = Path & FileName1 & "-" & DateTime & ".xlsm"
Call PressTheButton
ActiveWorkbook.SaveCopyAs Filename:=PathAndFileName
SetAttr PathAndFileName, vbReadOnly
End Sub}
I was wondering if anyone knew a way to save a file to a different folder based on the part number in B1? I want to create a folder for each part number and have the file save to that folder that is the same as the current part number in B1. Here is my current save code. it saves the file as a read only copy as the part number in B1 also with a time date stamp. Any help would be greatly appreciated. Thank you.
{Sub Save()
Dim Path As String
Dim FileName1 As String
Dim DateTime As String
Dim PathAndFileName As String
Path = "C:Libraries\Documents\"
If Range("B1").Value = "" Then
MsgBox "You Must Put a Value in Cell B1!"
Exit Sub
End If
FileName1 = Range("B1")
DateTime = " (" & Format(Now, "yyyy-mm-dd hhmm AMPM") & ").xlsm"
PathAndFileName = Path & FileName1 & "-" & DateTime & ".xlsm"
Call PressTheButton
ActiveWorkbook.SaveCopyAs Filename:=PathAndFileName
SetAttr PathAndFileName, vbReadOnly
End Sub}