idw PDF creation on save

idw PDF creation on save

Anonymous
Not applicable
693 Views
3 Replies
Message 1 of 4

idw PDF creation on save

Anonymous
Not applicable

I am wanting to save a PDF of an idw in Vault automatically.

I got this code from a link that works for saving the idw as a PDF in the folder shown V:\Vault\Designs\Stock Items\PDF

This code saves the idw as the file name e.g.. PDFBA1234.

 

Part Information:

The ipt & idw are BA1234.

I am wanting to use the information from the iproperties 'Project tab' part number which is this number BM5678.

 

If possible I would also like to save the PDFs with the idw in the same folder. Folder structure is below

Stock Items

-BA

-BB

-BC

etc

 

Can anyone help?

Thanks

 

 

strFolder = "V:\Vault\Designs\Stock Items\PDF" & ThisDoc.FileName(False) 'without extension

ThisDoc.Document.SaveAs(strFolder & (".pdf") , True)

MessageBox.Show("All file formats saved", "File Save")
0 Likes
694 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

 

I have got the iproperties value to sort of work now but it only names the PDF as 'B'.

I want it to use the whole name BM-0200....... etc

 

Can anyone help?

strFolder = "V:\Vault\Designs\Stock Items\PDF\" & iProperties.Value("Project", "Part Number")(False) 'without extension

ThisDoc.Document.SaveAs(strFolder & (".pdf") , True)

MessageBox.Show("PDF Created", "File Save")
0 Likes
Message 3 of 4

Anonymous
Not applicable

so are you wanting the user to choose which folder (BA, BB, etc) or are you wanting that to come from the first 2 letters of the Part Number?

 

This gets it to the PDF folder with the file name set to the Part Number. (the False was resulting in just B):

 

strFolder = "V:\Vault\Designs\Stock Items\PDF\" & iProperties.Value("Project", "Part Number")

ThisDoc.Document.SaveAs(strFolder & (".pdf") , True)

MessageBox.Show("PDF Created", "File Save")

 

 

 

 

0 Likes
Message 4 of 4

Anonymous
Not applicable

This saves the file to the folder that matches the first two letters of the Part Number property. For instance, if the Part# = BM5678

then the path = V:\Vault\Designs\Stock Items\PDF\BM

and the file name = BM5678.pdf

 

if the folder doesn't exist it doesn't work.

 

 

strFolder = iProperties.Value("Project", "Part Number")

strTrim = Left(strFolder,2)

strPath = "V:\Vault\Designs\Stock Items\PDF\" & strTrim & "\" &  iProperties.Value("Project", "Part Number")

ThisDoc.Document.SaveAs(strPath &(".pdf") , True)

MessageBox.Show("PDF Created", "File Save")

 

 

0 Likes