I'm currently working on a program that runs at the click of a button. Now that I am at the end of it, I need to save it where the user would like to save it - however - the end result is the product of synchronizing 2 files, and therefore will be assigned a name based on the subject's ID and which test they were doing.
This is where I am at:
Dim sav As Integer
Dim file_name As Variant
Dim sPath As String
Dim sFile As String
sPath = "C:\xxx\xxx\xxx\xxx\xxx\xxx\"
'Define the file name: Subject Session synced.txt
sFile = sSubID & " " & sSubSession & " synced.txt"
sav = MsgBox("Would you like to save this file?", 4, "Save?")
If sav = vbYes Then
file_name = Application.GetSaveAsFilename( _
Title:="Save As File Name")
ActiveWorkbook.SaveAs Filename:=sPath & sFile, FileFormat:=xlTextWindows, CreateBackup:=False
The sPath is set correctly - I modified it for confidentiality purposes.
I need to be able to take control of the named file, I just want the user to be able navigate to where it will be placed.. Any way of achieving this?
Currently, by entering anything at the desired location, it saves the correct file name, but I need this to be streamlined so I don't have techies saying "what the--WHERES MY FILE?"
I'm not extremely familiar with VBA, but I'm kind of comfortable at this point, so this was the closest I could come to what I need with Google/Bing.
Any suggestions?
PS. Ideally, I don't want it to save over the current workbook. It's OK that it overwrites the information, but when it saves it changes "Sheet1" to the file sFile, which bugs the program for the next button click. Any inputs on this would be appreciated as well :d
Bookmarks