Saving new document as label name in word VBA -


For a project, I have to prepare several Word documents with an individual performance report. I already have a macro which makes these personal reports what I need now a macro which uses the value of a created label (for example, I want to give the document the name of the "username" label) I'm afraid I can not provide the code because I did not get ahead of the "save as" command (which is not that easy). thank you in advanced.

If I understand correctly, you want to use label captions from your usermate Save the file name and after that as the file name?

I think you will then pass the label caption to the user from your module. If this is the case, then you simply add the label caption string together and then use ActiveDocument.SaveAs . See below:

  Sub Some Field () Dim NewFileName String 'Do Something' Something else 'Create and Send Labels' You will now create captions for your label' and then send them to labels 'Just different caption emailcontact = "someemail@email.com" add code = "2323" CaptureDate = "2015.09.21" Newfilename = EmailContact & amp; Code & amp; CaptureDate 'For this example' NewFileName is so = someemail@email.com23232105.09.21 'If you want to save it somewhere specially, you can add folder path to' NewFileName 'otherwise it will document my document from ActiveDocument. SaveAs (NewFileName) Finally sub  

You can insert this code in your user's "Save as" a command button label, and then type it in ActiveDocument .


Comments