Jump to content

How do I "Highlight All" and then "Save to Clipboard" in MS Word?


 Share

Recommended Posts

I am trying to write a script that will run on a form in MS Word. The script will select the entire document and save it to the clipboard. Then it will open Outlook Web Access, open a new message and paste the document into the message.

I can't get the "Send" command to work in MS Word. Should I be using the Send command or some other? Please give me all the help you can, I've never scripted before.

I am using the cursor control in Outlook Web Access to open a new message. Is there another way to do this?

Thanks, Ted Eiferman

teiferma@paulsboro.k12.nj.us

Link to comment
Share on other sites

I am trying to write a script that will run on a form in MS Word. The script will select the entire document and save it to the clipboard. Then it will open Outlook Web Access, open a new message and paste the document into the message.

I can't get the "Send" command to work in MS Word. Should I be using the Send command or some other? Please give me all the help you can, I've never scripted before.

I am using the cursor control in Outlook Web Access to open a new message. Is there another way to do this?

Thanks, Ted Eiferman

teiferma@paulsboro.k12.nj.us

I can answer the first part. Here's the solution using a bit of COM:

$sFilePath = "C:\Doc.doc"   ; path to the document you want to copy from

; Create COM object
$oWord = ObjCreate("Word.Application")

; Open the specified document
$oWord.Documents.Open($sFilePath)

; Make visible (optional!)
$oWord.Visible = 1

; Copy entire thing to clipboard
$oWord.Activedocument.Select
$oWord.Selection.Copy

; Put clipboard into variable
$sText = ClipGet()

; Switch to window you want to copy to
WinActivate("Untitled - Notepad")  ; or whatever

; Send variable contents to it
Send($sText)

As for how to control Outlook Web Access directly, perhaps someone else has an idea. This should give you the gist of the process, though.

-S

(Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent]
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...