04-28-2020
09:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
04-28-2020
09:22 AM
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