Hi all... Need a bit of help. What do I need to add to the code below in order to specify that my output (saveas) file is saved to the same path as the parent macro file? Here's the code I have for my SaveAs:
' Automatic New File Creation and Save
Dim bk As Workbook
Dim myFileName As String
With Worksheets("Input")
myFileName = .Range("TD").Value & "_" & .Range("IBMsn").Value
End With
Sheets("Output").Select
ActiveSheet.Copy ' creates new workbook
Set bk = ActiveWorkbook
bk.SaveAs Filename:=myFileName, FileFormat:=xlTextPrinter
bk.Close Savechanges:=False
MsgBox ("File creation complete! The flat file has been saved to the same directory as this macro file.")
' Automatic New File Creation and Save
Dim bk As Workbook
Dim myFileName As String
With Worksheets("Input")
myFileName = .Range("TD").Value & "_" & .Range("IBMsn").Value
End With
Sheets("Output").Select
ActiveSheet.Copy ' creates new workbook
Set bk = ActiveWorkbook
bk.SaveAs Filename:=myFileName, FileFormat:=xlTextPrinter
bk.Close Savechanges:=False
MsgBox ("File creation complete! The flat file has been saved to the same directory as this macro file.")