Copy from form & paste into a blank document

R

ronben

Version: 2004 Operating System: Mac OS X 10.4 (Tiger) Processor: Intel I am looking for a different strategy for the following (since the macro below does not work: A user fills out a form. A macro is needed to step through each of the form fields and then copy or paste the user-supplied content of each into a separate Word document. The idea is to "autogenerate" a letter from the contents of the form fields.

The following test macro did not work; got a compiler error: "invalid use of property".

Sub CopyTextToNewPage
   Dim vHistory as String
   vHistory = ActiveDocument.FormFields("Text1").Result
   ActiveDocument.FormFields("Text2")=vHistory
end sub

The compiler error highlighted is: FormFields("Text2")

I am probably missing something simple here. (I have found that the Macro editor is fussy about the kind of double-quotes used.)

Thanks,
BMK
 
J

John McGhie

If "Text2" exists (and you are not checking that it does...) then it will
have at least three parts: a Name, a Code, and a Result. Which one are you
attempting to set?

Cheers


Version: 2004 Operating System: Mac OS X 10.4 (Tiger) Processor: Intel I am
looking for a different strategy for the following (since the macro below does
not work: A user fills out a form. A macro is needed to step through each of
the form fields and then copy or paste the user-supplied content of each into
a separate Word document. The idea is to "autogenerate" a letter from the
contents of the form fields.

The following test macro did not work; got a compiler error: "invalid use of
property".

Sub CopyTextToNewPage
Dim vHistory as String
vHistory = ActiveDocument.FormFields("Text1").Result
ActiveDocument.FormFields("Text2")=vHistory
end sub

The compiler error highlighted is: FormFields("Text2")

I am probably missing something simple here. (I have found that the Macro
editor is fussy about the kind of double-quotes used.)

Thanks,
BMK

This email is my business email -- Please do not email me about forum
matters unless you intend to pay!

--

John McGhie, Microsoft MVP (Word, Mac Word), Consultant Technical Writer,
McGhie Information Engineering Pty Ltd
Sydney, Australia. | Ph: +61 (0)4 1209 1410
+61 4 1209 1410, mailto:[email protected]
 
J

John McGhie

:)


Ok. I got it now. Left out: .Result

Thanks,
Ron

This email is my business email -- Please do not email me about forum
matters unless you intend to pay!

--

John McGhie, Microsoft MVP (Word, Mac Word), Consultant Technical Writer,
McGhie Information Engineering Pty Ltd
Sydney, Australia. | Ph: +61 (0)4 1209 1410
+61 4 1209 1410, mailto:[email protected]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top