View Single Post
  #12   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Chariage Returns & Returns in Strings

Hi Dax,

Please help me to help you. Reply to this thread with the following
information:

- The number and the exact and complete text of the error message.

- The entire code of the macro that has the error, copied from the VBA
editor and pasted into the newsgroup post.

- If the error message includes a Debug button, click it. That will
open the VBA editor and yellow-highlight the line where the error
occurred. In the code you include in the post, point to that line.

Even without that information, I'll take a quick guess at what's
wrong: The code you inserted refers to a string named Str1, but the
rest of your macro doesn't contain any string with that name. Change
Str1 to the name of the string that contains the text to be inserted
into the field. And put the three lines *after* the place in the macro
that assigns the text to that string.

To answer your other question, you need these three lines in *every*
macro that tries to assign a long (more than 255 characters) string to
a form field. Putting it into only one of those macros is not
sufficient.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.


On Sun, 24 Jan 2010 10:43:01 -0800, Dax Arroway
wrote:

Hmmm. I think I hear what you're saying but my limited VBA knowledge
prevents me from making this work. I tried putting:

ActiveDocument.Unprotect
FmFld.Range.Fields(1).Result.Text = Str1
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True

into the top of the code and it errors. I then tried putting it below the
Sub PCCDim1()
and the
Dim ddresult As String
but I got another error. I'm obviously doing something wrong.

Could you please tell me if I'm on the right path? And to let you know
about my full project, I've got a table that's 4 columns by 6 rows. First
row has a dropdown in it with 5 choices. Each choice will populate columns 2
to 4 with different data--the text strings I'm including in the Macros. So
for each row (I'm not sure if this is the best practice or not) I'm using an
instance of the same code (w/different names and different text strings) to
get the results I need. Therefore, each dropdown menu throughout column 1
runs a different Macro (PCCDim1, PCCDim2, etc.). Which makes me woder if I
need to include this code in each instance of the different Macros or if it
only needs to be called once.

So, A) am I using the right code? B) Am I putting it in the right place?
And C) Should I only put it once or in all the Macros?