How do I save a file using the value entered in a text form field

MS WORD

    Next

  • 1. Phantom Break Points in Word VBA
    I have created a form with VBA controls on it. VBA will stop running the code, open the VBA development environment and highlight a line of code in YELLOW as if there was a break point there. I can hit the F5 and continue on no problem. Anyone seen this? What's causing it?
  • 2. Macro for Label printing
    My word automation is a little rustly, mainly use excel for everything. I need to automate a word document so that one label will be updated with the PO# and Item description passed from an excel procedure and by a userform if opened exclusively. This label contains two textbox which I need vba to replace the values, not as easy replacing values in a textbox?? Secondly, I'll need to copy the first label x number of times. Any help is greatly appreciated
  • 3. Copying Styles from Normal.dot
    Each user in our company has a normal.dot that contains the standard styles, plus additional styles the user may have created. I need a macro that copies all of the styles from the normal.dot into the active document when the attached template is not normal.dot and I can't change it to normal.dot. I have seen similar requests, but those requests seem to be for specifically-named styles. I have no control over how users name the styles in their normal.dot. My thought is to use a For Each...Next loop pointing to the styles in the normaldot, and then I need to define and use a variable for each style name. Here is my attempt. But it doesn't like the NormalTemplate.Styles part. I don't know how to get it to go through all the styles in normal.dot instead of activedocument.styles (which works fine). Can someone help me? TIA MarieJ Sub CopyNormalStyles() Dim fileName As String Dim tmpName As String Dim myStyle as Style Dim strStyleName as String tmpName = NormalTemplate.FullName fileName = ActiveDocument.FullName 'Need a For Each line here so it cycles through all the styles in Normal.dot For Each myStyle In NormalTemplate.Styles 'this doesn't work strStyleName = myStyle.NameLocal Application.OrganizerCopy Source:=tmpName, _ Destination:=fileName, Name:=strStyleName, _ Object:=wdOrganizerObjectStyles Next End Sub
  • 4. Word inserting section breaks automatically
    My application performs the following: 1. Get XML from document. 2. Transform it in some way. 3. Clear document. 4. InsertXML(transformed document) - including some tables. 5. Insert header and footer (using Sections[1].Headers[wdHeaderFooterFirstPage]). There are several problems here. 1. After step 4. Word has inserted a section break for me - I never asked for one. 2. When I save the document as an XML document, the header and footer is not saved. 3. When I save the document as a Word document (DOC), the header and footer is saved. 4. When I delete the section break, my header is deleted too. This is infuriating. Why does Word insert section breaks for me when I don't want them? How do I stop it from doing this? Why does Word not save my headers and footers in XML format but will in DOC format? TIA, Haydn
  • 5. creating electronic stationary
    I would like to create stationary where the header will be and remain in the same place, can't bemanipulated by subsequent users. I would like the cursor to be "ready to go" and the person composing the letter won't have to worry about margins, etc. Please help. I am using Windows XP Pro and Word 2003

How do I save a file using the value entered in a text form field

Postby U2NvSk8 » Fri, 24 Mar 2006 17:21:36 GMT

I have a word document that myself and others on my team must fill out 
repeatly. I created a simple template for the basic form to automate the 
process, I would like to automate the "Save As" file name using date from one 
of the "Text form Fields". the file name would be 
"SW_COA_XXXXXX_johnson.doc". The XXXXXX would be the numeric value entered in 
Text Form Field labeled "Text 2".  Can this be done?

Scott

Re: How do I save a file using the value entered in a text form field

Postby Doug Robbins - Word MVP » Sat, 25 Mar 2006 04:10:58 GMT

With ActiveDocument
    .SaveAs "SW_COA_" & .Formfields("Text2").Result & "_johnson.doc"
End With

I suggest that you give a more meaninful name to the bookmarks assigned to 
your formfields.

-- 
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP








How do I save a file using the value entered in a text form field

Postby R2VvZmY » Fri, 14 Aug 2009 23:02:01 GMT

There was a post from a few years ago asking how to do this, to which the 
following response was given.





I tried to do this with a module within a macro-enabled Word 2007 template, 
but I get an error telling me "the requested member of the collection does 
not exist".

If I go to the locals window, ActiveDocument isn't even there. Sorry, my
VisualBasic is a lot stronger within Access. But if I am running the code
from an open template with data, how can there not be an active document?

TIA

Re: How do I save a file using the value entered in a text form field

Postby Graham Mayor » Fri, 14 Aug 2009 23:49:33 GMT

Frankly I would error trap this to ensure that the form field has been 
filled before saving, but your error message reflects that your form does 
not have a form field called "Text2".

Sub SaveForm()
With ActiveDocument
    If .FormFields("Text2").Result <> "" Then
        .SaveAs "SW_COA_" & .FormFields("Text2").Result & "_johnson.doc"
    Else
        MsgBox "Form field must be completed"
        .FormFields("Text2").Select
    End If
End With
End Sub


-- 
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site  http://www.**--****.com/ 
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>








Similar Threads:

1.How do I save a file using the value entered in a text form fi

DOUG,
Thanks for the help, it worked like a charm.

Scott Johnson


"Doug Robbins - Word MVP" wrote:

> With ActiveDocument
>     .SaveAs "SW_COA_" & .Formfields("Text2").Result & "_johnson.doc"
> End With
> 
> I suggest that you give a more meaninful name to the bookmarks assigned to 
> your formfields.
> 
> -- 
> Hope this helps.
> 
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
> 
> Doug Robbins - Word MVP
> 
> "ScoJO" < XXXX@XXXXX.COM > wrote in message 
> news: XXXX@XXXXX.COM ...
> >I have a word document that myself and others on my team must fill out
> > repeatly. I created a simple template for the basic form to automate the
> > process, I would like to automate the "Save As" file name using date from 
> > one
> > of the "Text form Fields". the file name would be
> > "SW_COA_XXXXXX_johnson.doc". The XXXXXX would be the numeric value entered 
> > in
> > Text Form Field labeled "Text 2".  Can this be done?
> >
> > Scott 
> 
> 
> 

2.How to limit text height entered into a Legacy Form Text Form Field

Hi folks
Hopefully someone can help me here as Ive spent hours looking on the
web for an answer :(
I have created a form which is protected, so people can only see the
form and then enter text into Text Form Fields. When I type into this
field, the text wraps around before it reaches the end (width) of the
box but not the height! How do I limit the text so that the number of
lines typed in is only as much as is visible within the box? (height)?
thanks
d




-- 
corelli

3.disable the enter key when using text form field

Can you make the text form field not allow someone to press the enter key and 
start and new line and change the lines in the form.?

This was answered in 2006 but the link in the answer no long works.  Thanks 
in advance for any help

4.Automatically enter values in the text fields

Hi,

I have a webpage with two text fields, and a button.  Text fields are
for Names and phonenumber.  Once user clicks on the button, the form
does some processing.

Problem is that I have a huge file with names and numbers.  I could
either manually copy paste all these names and numbers in those fields
or I could write a simple program which actually does that for me and
then presses the button.  This way I will save days worth of work.  I
am not even sure if it is possible.

How would I be able to post date to the form?

Thanks

5.form fields showing "form text" instead of values

A guy called us here at tech support and I'm stumped by this one.
Someone sent him a Word doc wih some form fields, which are supposed
to be pre-populated with values and the document is password
protected.

When he prints this document all the text fields print out as they're
supposed to. However, on screen, word shows each of them as saying
simply "form text" instead of the actual value they hold.

He mailed the files here and they look fine on our copies of Word, and
so far we haven't been able to duplicate his issueto find out what
option he needs to adjust. anyone have any ideas? Many TIA!

6. removing text form fields while saving text

7. Text Form Field, Check Box Form Field, Drop-Down Form Field

8. Enter Text into Fields using Input Boxes



Return to MS WORD

 

Who is online

Users browsing this forum: No registered users and 28 guest