#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Macro

is it possible to control Notepad from a macro ie open a new notepad, paste
data in and then save as.

If so how do i call notepad in VB

thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Macro

Not sure why you don't just save the Excel file as TEXT, Paste data (use
PasteSpecial Text only") into new Excell Workbook and save as Text. You
could open Word and paste data into word and then save word as a text
document.

"Arnie" wrote:

is it possible to control Notepad from a macro ie open a new notepad, paste
data in and then save as.

If so how do i call notepad in VB

thanks in advance

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Macro

You can open notepad with the following statements and then change the focus
to the NotePad window with these commands

Root = Environ("SystemRoot")

ID = Shell(Root & "\Notepad.exe")
AppActivate ID

Use copy commnd from excel to put data into Cliupbord before opening Notepad
and changing the focus. Then use "SendKey" commnd to send the key stokes
required to Notepad. You can use the ShortCuts in NotePad like Cntl+V to
paste.

"Arnie" wrote:

is it possible to control Notepad from a macro ie open a new notepad, paste
data in and then save as.

If so how do i call notepad in VB

thanks in advance

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Macro

Thanks i did find this

Shell "notepad.exe", vbNormalFocus
Application.SendKeys ("^V")

which works for opening and pasting
but i can't find anything for SaveAs

i am selecting data from different sheets in excel then using notepad to
paste this data into. the notepad is then saved as a script file. Hence the
need to control notepad

"Joel" wrote:

You can open notepad with the following statements and then change the focus
to the NotePad window with these commands

Root = Environ("SystemRoot")

ID = Shell(Root & "\Notepad.exe")
AppActivate ID

Use copy commnd from excel to put data into Cliupbord before opening Notepad
and changing the focus. Then use "SendKey" commnd to send the key stokes
required to Notepad. You can use the ShortCuts in NotePad like Cntl+V to
paste.

"Arnie" wrote:

is it possible to control Notepad from a macro ie open a new notepad, paste
data in and then save as.

If so how do i call notepad in VB

thanks in advance

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Macro

My code is equivalent to yours but is more robust by specifying the ID
(incase multiple NotePad applications are open) and wil work if a different
folder is the default folder.

Root = Environ("SystemRoot")

ID = Shell(Root & "\Notepad.exe", vbNormalFocus)
SendKeys "^v", Wait:=True
SendKeys "^s", Wait:=True
SendKeys "%n", Wait:=True
SendKeys "c:\temp\abc.txt{Enter}", Wait:=True

"Arnie" wrote:

Thanks i did find this

Shell "notepad.exe", vbNormalFocus
Application.SendKeys ("^V")

which works for opening and pasting
but i can't find anything for SaveAs

i am selecting data from different sheets in excel then using notepad to
paste this data into. the notepad is then saved as a script file. Hence the
need to control notepad

"Joel" wrote:

You can open notepad with the following statements and then change the focus
to the NotePad window with these commands

Root = Environ("SystemRoot")

ID = Shell(Root & "\Notepad.exe")
AppActivate ID

Use copy commnd from excel to put data into Cliupbord before opening Notepad
and changing the focus. Then use "SendKey" commnd to send the key stokes
required to Notepad. You can use the ShortCuts in NotePad like Cntl+V to
paste.

"Arnie" wrote:

is it possible to control Notepad from a macro ie open a new notepad, paste
data in and then save as.

If so how do i call notepad in VB

thanks in advance

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
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro to copy and paste values (columns)I have a macro file built C02C04 Excel Programming 2 May 2nd 08 01:51 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 08:03 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"