06-01-2020
01:58 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
06-01-2020
01:58 PM
have a look at the following iLogic code. it's not exact what you asked for but i think it is what you want. It makes a copy of the active document. Also it sets the iproperty Project to the project number that was given.
I added 2 comments in the code. At the first it allowes you to set a template file name. The other shows you where you can add extra iProperties to set.
Dim projectNumber = InputBox("What is the project numebr", "Project number", "") Dim folderBrowserDialog1 = New System.Windows.Forms.FolderBrowserDialog() Dim path As String = "" If (folderBrowserDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK) Then path = folderBrowserDialog1.SelectedPath Else Return End If Dim doc As Document = ThisApplication.ActiveDocument Dim fileInfo As System.IO.FileInfo = New System.IO.FileInfo(doc.FullFileName) ' Replace the text test in the next line with something meaning full for you Dim newFileName As String = String.Format("test {0} test{1}", projectNumber, fileInfo.Extension ) Dim newFullFileName As String = System.IO.Path.Combine(path, newFileName ) System.IO.File.Copy(fileInfo.FullName, newFullFileName, True ) Dim newDoc As Document = ThisApplication.Documents.Open(newFullFileName) newDoc.PropertySets("Design Tracking Properties")("Project").Value = projectNumber ' set more properies here if you want newDoc.Save() Dim res = MessageBox.Show("File is created. do you want to close it?", "File created" ,MessageBoxButtons.YesNo) If (res = DialogResult.Yes) Then newDoc.Close() End If
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Blog: hjalte.nl - github.com