Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / May 2008

Tip: Looking for answers? Try searching our database.

Autonaming doc on save using data from fill-in fields

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Castor&Pollux - 23 May 2008 02:46 GMT
Hi All

I have read a couple of threads asking for similar stuff to what I'm looking
for but can't seem to get anything to work for me!

I have a word doc template that prompts the user upon opening to enter info
in fill-in fields.  The fill-in fields are also bookmarked and ref fields
relating to the bookmarks appear in other parts of the document.

What I'd really like to do is when the user tries to close or save the
document it automatically uses data from two of the fill-in fields/bookmarks
as the document title.

Not sure if I'm going about things right in the set-up of my document to
start with so any advice is much appreciated.

Thanks :)
Cindy M. - 25 May 2008 09:29 GMT
Hi =?Utf-8?B?Q2FzdG9yJlBvbGx1eA==?=,

Show us the code you've tried, please. And which version of Word are you using?

> I have read a couple of threads asking for similar stuff to what I'm looking
> for but can't seem to get anything to work for me!
[quoted text clipped - 9 lines]
> Not sure if I'm going about things right in the set-up of my document to
> start with so any advice is much appreciated.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)
Castor&Pollux - 28 May 2008 07:51 GMT
Hi Cindy M

I am using Word 2003.  I've tried playing with both of the following bits of
code which I pinched out of other threads in this forum.

With ActiveDocument
      .SaveAs .Formfields("From").Result
End With

(I changed the "From" to the name of one of my ref fields).

AND

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

(I got rid of the "SW_COA" & at the front, adjusted the "Text 2" to the name
of one of my ref fields and adjusted "_johnson.doc" to the remainder of my
proposed title).

The documents I am working on are templates for writing standardised
procedures.  On closing, or saving the document I'd like the automatic
suggestion of "document title (SSAP) vX".  Basically the "document title" and
the "X" would be the results entered in two fill-in fields (or ref fields if
need be).

I don't really have a great understanding of VBA as yet so the more straight
forward any direction, the better!

Let me know if you need any further info... hope it all makes sense!!!

Thanks

Castor&Pollux

> Hi =?Utf-8?B?Q2FzdG9yJlBvbGx1eA==?=,
>
[quoted text clipped - 21 lines]
> This reply is posted in the Newsgroup; please post any follow question or reply
> in the newsgroup and not by e-mail :-)
Cindy M. - 28 May 2008 11:10 GMT
Hi P&C,

> The documents I am working on are templates for writing standardised
> procedures.  On closing, or saving the document I'd like the automatic
> suggestion of "document title (SSAP) vX".  Basically the "document title" and
> the "X" would be the results entered in two fill-in fields (or ref fields if
> need be).

Right. Formfields are not the same as bookmarks, which is why you weren't able
to use the code snippets you found. A form field name is also a bookmark, but
the reverse does not apply.

The following shows you the approach I'd use. I may have not gotten the details
quite right (I don't know the bookmark names, for example), but you should be
able to adjust it to fit your needs.

   Dim sDocTitle as String
   Dim sX as String
   Dim doc as Word.Document
   
   Set doc = ActiveDocument
   sDocTitle = doc.Bookmarks("Name").Range.Text
   sX = doc.Bookmarks("otherName").Range.Text

   doc.SaveAs sDocTitle & " (SSAP)v" & sX & *.doc"

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.