Good Morning,
I am trying to change the file location that the file is created in from "MyDoccuments" to "\\prod\userdata\IS-3\FSD-SysDev\HD\MonthendHosp\Monthend Automation processes "
I am also trying to get the Before save function to work on my code so that it automatically updates the .txt file when the user hits save.
Here is what I have:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
a = MsgBox("Do you really want to save the workbook?", vbYesNo)
If a = vbNo Then Cancel = True
Next N
Option Explicit
Sub SaveAsPipeDelimited()
Const DELIMITER As String = "|"
Dim myRecord As Range
Dim myField As Range
Dim nFileNum As Long
Dim sOut As String
Dim N As Long
nFileNum = FreeFile
Open "EOMStatsForKirk.txt" For Output As #nFileNum
For N = 1 To ActiveSheet.UsedRange.Rows.Count
Print #nFileNum, Cells(N, 1) & "|" & Cells(N, 3) & "|" & Cells(N, 5) & "|" & Cells(N, 12)
Next N
Close #nFileNum
End Sub
Please advise when possible. I need to have this completed today! Thank you so much for your help in advance.
Bookmarks