Handling Notepad Using VBA from Excel
Posted on 2006-10-19
I am trying to send a cut-list from excel to a program called genesis/evolution on my CNC machine. The file is to be read from a folder called "LSX". The file extension is ".LST".
The list will not open in Genesis if it is in excel ".csv" format. However, I found that it will work if I:
1) Right click on the excel file (in .csv format) icon and "open with" Notepad (also appears with .csv extension)
2) Make some changes to the text in Notepad:
a) The file appears as follows once opened in Notepad:
text1,text2,text3,text4,text5,text6,text7 etc. (line2)
text1,text2,text3,text4,text5,text6,text7 etc. (line3) etc.
b) I need to delete all of the extra commas at the end of the first line so I'm left with just: LST,1,
c) Finally I need to do a "Find" and "Replace" to change all of the remaining commas to semicolons. The file will not open if it is delineated with commas.
3) "Save As" from Notepad with a ".txt" extension and close the open Notepad window.
4) Right click and "Rename" the file with the extension ".LST".
I can now open this file successfully from the above mentioned "LSX" folder
- note that if I save directly with an ".LST" extension and skip the ".txt" part at step #3, it does not work.
Could I please get some help in automating this sequence from excel using VBA?
I understand that it might not be possible to manipulate Notepad with VBA and an alternative approach may be necessary.
I am not a programmer, and as much coding help as possible would be greatly appreciated.