| View previous topic :: View next topic |
| Author |
Message |
Chris X1 Newbie
Joined: 10 Jan 2004 Posts: 1
|
Posted: Jan 10th, 2004 09:36 AM Post subject: Using vb to copy and paste from word |
|
|
Hello all
I am creating a database program and a feature will be to mail merge from microsoft word. The idea is to have the user write a letter and this would be copied into a variable in visual basic, here i can write code to place in names etc, the finalised letter then needs to be pasted back into word (either the original document or a new one, it does not matter). I can manipulate the letter myself, however, how do you copy and paste the letter into a visual basic variable? And how will i then be able to paste it back into word using vb?
Thanks for any help |
|
| Back to top |
|
P.T.A.M. Administrator

Joined: 08 Oct 2003 Posts: 752 Location: Greece
|
Posted: Jan 10th, 2004 04:00 PM Post subject: |
|
|
I suppose that with the [api]FindWindow[/api] and [api]FindWindowEx[/api] APIs you could get the handle of word. Then maybe with the [api]GetWindowText[/api] you could get the text and store it in a variable  _________________ No one is completely useless. They can at least be an example of what to avoid. |
|
| Back to top |
|
Andir Centurion

Joined: 21 Dec 2003 Posts: 184 Location: Chicago Area
|
Posted: Jan 10th, 2004 07:57 PM Post subject: |
|
|
I think with the VBA code you wouldn't need to do that. As far as mail merge, I remember going to school and they tried to teach me how to do that without code. I can tell you it's possible, but I'm going to be away from a PC for about a week, so I won't get to try till I get back. Sorry :/ _________________ If you happen to see little people sitting on your desk...don't tell anyone or they might think your crazy too. |
|
| Back to top |
|
|