Bit of stupid one i'm afraid - i'm running some vb in excel and want to cut and paste the resulting data in to notepad and then save it - anyone able to help???
Thanks
John
Printable View
Bit of stupid one i'm afraid - i'm running some vb in excel and want to cut and paste the resulting data in to notepad and then save it - anyone able to help???
Thanks
John
Why not just save the text directly into a .txt file;
Open "myfile.txt" for Output as #1
Print #1, [whatever text you want to]
Close #1
If I'm missing the point you could always try;
Clipboard.SetText "[the text]"
Shell "notepad.exe", vbNormalFocus
SendKeys "%V",True 'to paste the text
SendKeys "%FS",True 'to save the file
This should prompt the user for the filename - if you want to fill this in automatically you could try adding
SendKeys "filename.text{ENTER}",True
To close notepad;
SendKeys "%{F4}",True
I haven't tested this second solution so it may not work..
thanks for this - i think that i haven't explained what i need very well. i'm using excel to format a load of data so that the data appears in in lines of 75bytes (punchcard!)what i need to be able to do is a straightforward cut and paste so that the formatting is preserved (as it is if you do it manually). Then i'm going to save the notepad file and write a script to feed it in to a dbase (flatfile nightmare) that i'm working with. I can't unfortunately just drop data into backend tables.....so this is my best workaround at the moment. I considered doing the formatting in PFE but writing the macro turned out to be a nightmare....
thanks
John ; )