Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Open recently made .csv in notepad

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Open recently made .csv in notepad

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Open recently made .csv in notepad

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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default 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






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Open recently made .csv in notepad

Thanks for your help

"Tim Williams" wrote:

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







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why won't Excel open xls file after I saved it with notepad! Kurt[_4_] Excel Discussion (Misc queries) 4 July 15th 09 05:58 PM
Cannot open a .dbf in Excel that was saved in NotePad SherryScrapDog Excel Discussion (Misc queries) 0 November 8th 07 12:48 AM
files open in notepad HGP Setting up and Configuration of Excel 1 January 6th 07 04:03 PM
Cannot open files in Most Recently Used List Suzan Excel Discussion (Misc queries) 3 July 29th 06 11:32 PM
Can I open documents made with Quatro Pro with Excel docfluir Excel Discussion (Misc queries) 5 July 17th 05 11:59 PM


All times are GMT +1. The time now is 02:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"