How to change word file name before saving?
Hello
My VB6 application creates report into MS Word documents. When I create new blank document the names look like Document1, Document2 ....
But what I need to achieve is change this name based on my entered text before saving!
I've tried to change through the property doc.Name but it's read only.
the code bellow also doesn't solve my problem:
Code:
doc.BuiltInDocumentProperties(wdPropertyTitle) = DocumentName
doc.ActiveWindow.Caption = DocumentName
This changed name is important for me as I use it as automated text in document footer and it is still only "Document1".
In summary, I want to create Word document, change name from "Document1" to my value, generate footer with my value DocumentName but everything without saving!!!
Can somebody help me?
Re: How to change word file name before saving?
you can not change the name of a document while it is open
you can change the caption displayed
you can change the title, which may later be used as a suggested file name if using saveAs
you can put a field in your footer, it will then have the correct document name after it has been saved
if you are never going to save the document you can put your own string in the footer as filename