![]() |
#1
|
|||
|
|||
![]() Quote:
This code works wonders form me great job. I have one request though. Is it at all possible to change the code at the strname variable from the user of the system to a string in the actual document. I'm creating a form for my employees to enter clients information and have created a field for the customer name that I want the code to use as the name of the file. If it helps at all I have mapped the customer name to an xml node that i use for filling other fields throughout the document. Thanks, Zach Jennings Last edited by macropod; 09-20-2022 at 02:42 PM. Reason: Split from: https://www.msofficeforums.com/word/11748-add-save-button-form-template.html |
#2
|
||||
|
||||
![]()
You wouldn't be able to do that via a Document_New macro, since your save string wouldn't exist immediately the document is created. One would have to wait until the user attempts to save the document for the first time.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
||||
|
||||
![]()
Zach
I think Paul misunderstood your question. Yes you can use a string (or xml value) from your actual document. You haven't provided enough details in order for us to give you the actual code update. As an example since you are using xml mapping, you might want the contents of the first Content Control in the document to be part of the filename. Code:
StrName = ActiveDocument.ContentControls(1).Range.Text & Format(Now, "YYYYMMDD")
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Robert Kay | Word VBA | 6 | 02-21-2018 04:41 PM |
![]() |
PRA007 | Word VBA | 1 | 12-18-2015 09:23 PM |
![]() |
omahadivision | Excel Programming | 12 | 11-23-2013 12:10 PM |
Replacing text string within document, it's not retaining formatting | livemusic | Word | 4 | 02-25-2013 12:33 AM |
![]() |
VBNation | Word VBA | 2 | 02-08-2013 07:14 AM |