Open recently made .csv in notepad
Sub TesterNP()
ShowInNotepad "C:\local files\test.txt"
End Sub
Sub ShowInNotepad(sPath)
Shell "notepad.exe """ & sPath & """", vbNormalFocus
End Sub
Tim
--
Tim Williams
Palo Alto, CA
"Rick K" wrote in message
...
Here ya go...
'Open from from macro
Private Sub UserForm_Activate()
End Sub
'------------------------------------
Private Sub cmdRun_Click()
If txtFileName.Text = "" Then
MsgBox ("Can not proceed. No file name."), vbCritical
Else
Call PlaceText
End If
End Sub
Private Sub PlaceText()
Dim yr
yr = Format(Date, "yyyymmdd")
Dim tm
tm = Format(Time, "hhmmss")
Dim Mydate
Mydate = yr & tm
Dim myStr As String
myStr = "{ICC}DATBOOK" & Space(1) & "ZZ:CJKUSA" & Space(9) &
"ZZ:MGHDATA" & Space(8) & Mydate & Space(17) & "X"
Range("A1").Value = myStr
Call ExportCSV
End Sub
Private Sub ExportCSV()
Dim s As Worksheet
Dim fName
fName = UserForm.txtFileName.Text
Dim strPath As String
With Application
.ScreenUpdating = False
.DisplayAlerts = False
End With
strPath = "C:\somecustomerFiles\"
For Each s In ActiveWorkbook.Worksheets
s.SaveAs strPath & fName, xlCSV
Next s
Set s = Nothing
MsgBox ("CSV file saved in 'c:\somecustomers' folder"), vbInformation
Call OpenNotePad
End Sub
Private Sub OpenNotePad()
Shell "C:\winnt\notepad.exe"
Call CloseWorkBk
End Sub
Private Sub CloseWorkBk()
UserForm.Hide
Application.DisplayAlerts = False
Workbooks.Close
End Sub
"Tim Williams" wrote:
Show your code which creates the CSV file: easier to modify that then to
create something from scratch.
Probably Shell() is waht you need.
Tim
--
Tim Williams
Palo Alto, CA
"Rick K" wrote in message
...
I've created a working inventory xl file that saves a copy as a csv
file.
But
this .csv requires some clean up before being ftp'd to it's
destination.
In
the VBA end I am opening (after all else is completed) notepad.exe,
but I
like it to open with the recently saved csv file. Our people will be
inputing
a file name into a textbox on the user form , which is then saved to
C:\ABC\
folder. How can I have notepad open with the newly created csv file?
Thanks
|