Hi,
I need help completing a macro.
I need to copy data from an excel worksheet into a notepad file on a daily basis.
The data from excel changes modestly from day to day and I need to completely update (replace) the contents of the notepad file everytime I run the macro.
So far I have:
Sub test1()
Sheets("100").Select
Columns("G:K").Select
Range("G620").Activate
Selection.Copy
RSP = Shell("notepad.exe c:\data100.txt", vbNormalFocus)
SendKeys "^V"
End Sub
This does a great job of copying the correct data from excel, opening notepad, and pasting the data into notepad.
But...What I need is it to replace everything that is already in the data100.txt document.
I thought that if I could force notepad to "select all" by inserting SendKeys "^A" like this:
RSP = Shell("notepad.exe c:\data100.txt", vbNormalFocus)
SendKeys "^A"
SendKeys "^V"
that the paste would replace the existing data. But it isn't. It only pastes the new data after the existing data.
After the paste I also need to save & close the notepad file.
Any help would be much appreciated as I am very new to VBA and have struggeled with this for most of the day.
Thanks
Bookmarks