Copy all text from textbox, open notepad, and automatically paste to new notepad shee

Kevalson
10-01-2002, 10:23 AM
Hello everyone.

I am trying to copy all text, that is already in the textbox, to a new notepad sheet.

Example:

Step 1. Copy all text in Text1 box to clipboard.
Step 2. Open Notepad
Step 3. Paste clipboard to notepad.

All this should be done with one click of a button.

I get as far as copying everything to the clipboard, and it even opens up notepad, but I still have to manually paste (CTRL-V) into notepad.

I would even like it to ask me what name to save it as as well as where to save it at...just like the Save As function in Word or something.

Here is what I have so far.

Private Sub cmdCopytoClipboard_Click()
Dim MyAppID
Clipboard.Clear
Clipboard.SetText Text1.Text
MyAppID = Shell("NOTEPAD.EXE", 1)
AppActivate MyAppID
MyAppID = Clipboard.GetText()


End Sub

Flyguy
10-01-2002, 11:10 AM
You could use the SendKeys command to simulate keyboard usage.

Kevalson
10-01-2002, 12:32 PM
???

How do you mean.

I want to copy the clipboard to notepad.

Do you have an example of what you are referring?

stauf
10-01-2002, 12:37 PM
replace MyAppID = Clipboard.GetText() by sendkeys Clipboard.GetText()
if you don't really want to get your text to the clipboard.. just use sendkeys text1.text after your appactivate

Flyguy
10-01-2002, 12:48 PM
Or just:

Private Sub cmdCopytoClipboard_Click()
Dim MyAppID
Clipboard.Clear
Clipboard.SetText Text1.Text
MyAppID = Shell("NOTEPAD.EXE", 1)
AppActivate MyAppID
SendKeys "^V", True ' send CTRL-V
End Sub

Kevalson
10-01-2002, 02:34 PM
Oh...

Well, that works...

Thank you...

Now I am off to figure out how to get it to pull up the Save as window and ask me the filename and directory to where I want to open the file, and then paste the clipboard into it.

Kinda like a Save as window as in word or what not.

Mikecrosoft
10-01-2002, 03:01 PM
You need a CommonDialog to show this type of window.

ChiefRedBull
10-01-2002, 03:23 PM
This is the Microsoft Common Dialog Control, but:

Why bother showing the dialog, if you're going to paste the
filename into it? The whole point is that you let the user choose
the filepath...

Alternatively, if you want a default value in there, just set the
.FileName property of the Common Dialog Control before you
call the ShowSave() method.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum