- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I tweaked a Cadline Code and created an external rule and a global form (shown here). From Inventor, it Checks if a document exists and if not creates it or opens it. (a word template), autofill's Name and Description. and gives it the same name as the cad file and saves it into the same folder. ( I may have to change that but that's for another day.)
This is all on my local drives. I will now get it saved into the company vault, ext rules area. I also need to save the template in the vault templates file. I am wondering how (I have replaced the path with xxx for this forum - confidentiality and all that.) I point to the template in vault. Not done this before. And have the subsequent word doc which is created in my local, be checked in to vault.
'Code orginally Cadline Code - modified. 'set the folder name from the template report folder = "xxx" 'Create the Word Application Object wordApp = Interaction.CreateObject("Word.Application") 'Add the template document to the Word Session wordDoc = wordApp.Documents.Add(folder & "ilogic_report_template.docx", Visible:= False) 'Write to the Bookmarks in the template wordDoc.Bookmarks("FNAME").Range.Text = ThisDoc.FileName(False) 'without extension wordDoc.Bookmarks("DESC").Range.Text = iProperties.Value("Project", "Description") 'wordDoc.Bookmarks("PNUM").Range.Text = iProperties.Value("Project", "Part Number") 'wordDoc.Bookmarks("DES").Range.Text = iProperties.Value("Summary","Author") 'wordDoc.Bookmarks("RNUM").Range.Text = iProperties.Value("Project","Revision Number") 'save iso view to jpg imagedoc = ThisDoc.PathAndFileName(False) & ".jpg" oCamera = InventorVb.Application.ActiveView.Camera 'current iso view oCamera.fit oCamera.apply InventorVb.Application.ActiveView.SaveAsBitmap(imagedoc,1200,800) 'Insert an image at the end of the document wordDoc.Bookmarks.Item("\endofdoc").Range.InlineShapes.AddPicture(imagedoc) 'Save the Word file with a new name and close the document wordDoc.SaveAs(ThisDoc.PathAndFileName(False) & ".docx") wordDoc.Close() wordDoc = Nothing 'Quit Word session wordApp.Application.Quit() wordApp = Nothing 'Message box prompt – Added by Clint Brown @ Cadline i = MessageBox.Show("Would you like to see the Report?", "Cadline Community",MessageBoxButtons.YesNo,MessageBoxIcon.Question) If i = vbYes Then ThisDoc.Launch(ThisDoc.PathAndFileName(False) & ".docx")
Solved! Go to Solution.