Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-10-2019, 11:31 AM
wolfgrrl wolfgrrl is offline Sequential numbering across multiple docs Windows 10 Sequential numbering across multiple docs Office 2010
Novice
 
Join Date: May 2019
Posts: 15
wolfgrrl is on a distinguished road
Default

This is the code I'm using.



Code:
Private Sub Document_New()
Application.ScreenUpdating = False
Dim InvoiceFile As String, InvNum As String
InvoiceFile = Options.DefaultFilePath(wdDocumentsPath) = "N:\Engineering\ECN & ER Forms" & "\NUMBERS.ini"
InvNum = System.PrivateProfileString(InvoiceFile, "InvoiceNumber", "InvNum")
'If there is no InvoiceNumber reference in the ini file
'Create one and set the number to 1, otherwise increment the number
If InvNum = "" Then
  InvNum = 1
Else
  InvNum = InvNum + 1
End If
System.PrivateProfileString(InvoiceFile, "InvoiceNumber", "InvNum") = InvNum
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
End Sub
InvNum exists in custom properties.

NUMBERS.ini is stored in the same location as the form on the network.

Getting the error shown below. Can someone assist?

Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sequential numbering across multiple docs How do I do a Sequential Numbering? gburya Word VBA 26 07-04-2017 03:29 PM
Sequential numbering across multiple docs Sequential Page Numbering of Multiple Word Docs bobmard Word 8 08-24-2011 08:51 AM
Sequential numbering across multiple docs Editing multiple docs 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

Other Forums: Access Forums

All times are GMT -7. The time now is 03:47 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft