Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Eide.N
in reply to: antoniobaron

Nice! 

It seems to work without checking the file type. I then combined that with some excel tomfoolery - just put the starting PN in cell A2 in your excel file... (This script only runs if the file hasn't been saved before. ) 

 

'If not saved
If ThisDoc.Path = "" Then

	'look at the excel file, update PN and save
	GoExcel.Open("C:\Work\Local\SequentialPN.xlsx", "Sheet1")
		PreviousNumber = GoExcel.CellValue("A2")
		NewNumber = (PreviousNumber + 1)
		'MessageBox.Show(PreviousNumber & vbLf & NewNumber)
		GoExcel.CellValue("A2") = NewNumber
		iProperties.Value("Project", "Part Number") = NewNumber
	GoExcel.Save()

	'Set Browser Node Name - When part is saved, saves as this name
	ThisDoc.Document.DisplayName = NewNumber
End If