![]() |
#16
|
|||
|
|||
![]()
I've got this code working now.
Code:
Private Sub Document_New() Application.ScreenUpdating = False Dim InvNum As String With ThisDocument InvNum = .CustomDocumentProperties("InvNum") + 1 .CustomDocumentProperties("InvNum") = InvNum '.Save End With With ActiveDocument 'Update the value stored in the document property .CustomDocumentProperties("InvNum") = InvNum 'Update the fields in the document .Fields.Update End With Application.ScreenUpdating = True ActiveDocument.FormFields("ECNNUM").Result = InputBox("Please enter the ECN number. ") ActiveDocument.Fields.Update End Sub Code:
With Application.Dialogs(wdDialogFileSaveAs) .Name = "c:\My Documents\SaveExample.docm" .Format = wdFormatXMLDocumentMacroEnabled .Show Thank you for all your assistance! |
#17
|
|||
|
|||
![]()
Try
ActiveDocument.Save It should bring up a save dialog in a new document. This is what it produces in Word 2019. |
#18
|
||||
|
||||
![]()
Try:
Code:
Private Sub Document_New() Application.ScreenUpdating = False Dim InvNum As String With ThisDocument InvNum = .CustomDocumentProperties("InvNum") + 1 .CustomDocumentProperties("InvNum") = InvNum .Save End With With ActiveDocument 'Update the value stored in the document property .CustomDocumentProperties("InvNum") = InvNum 'Update the fields in the document .FormFields("ECNNUM").Result = InputBox("Please enter the ECN number. ") .Fields.Update End With Application.ScreenUpdating = True With Application.Dialogs(wdDialogFileSaveAs) .Name = "c:\My Documents\SaveExample.docx" .Format = wdFormatXMLDocument .Show End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#19
|
|||
|
|||
![]()
@macropod,
I copied the code as it was posted. The save command was commented out in the original post ![]() I'll try this new code and see how it works. Thank you! |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
gburya | Word VBA | 26 | 07-04-2017 03:29 PM |
![]() |
bobmard | Word | 8 | 08-24-2011 08:51 AM |
![]() |
frankdh | Word | 2 | 11-02-2010 10:59 AM |
Please help with Numbering a document with multiple letters. | DJReality213 | Office | 1 | 01-15-2010 05:56 PM |
Amend footer in multiple word docs? | compact | Word | 2 | 02-24-2009 09:40 AM |