Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This is the code I've been using (borrowing):
SyntaxEditor Code Snippet
'------start of iLogic-------'oPath = ThisDoc.Path C:\Dwf oPath = "C:\Dwf" oFileName = ThisDoc.FileName(False) 'without extension'oRevNum = iProperties.Value("Project", "Revision Number") oPartNum = iProperties.Value("Project", "Part Number") oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById _ ("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}") oDocument = ThisApplication.ActiveDocument oContext = ThisApplication.TransientObjects.CreateTranslationContext oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism oOptions = ThisApplication.TransientObjects.CreateNameValueMap oDataMedium = ThisApplication.TransientObjects.CreateDataMedium 'get PDF target folder path oFolder = Left(oPath, InStrRev(oPath, "\")) & "Dwf" 'Check for the PDF folder and create it if it does not exist If Not System.IO.Directory.Exists(oFolder) Then System.IO.Directory.CreateDirectory(oFolder) End If iName = iProperties.Value("Project", "Part Number") MessageBox.Show( oPath, iName) 'Set the dwf target file name oDataMedium.FileName = oFolder & "\" & iName & ".dwf" 'Publish document oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium) '------end of iLogic-------
It works - it was for pdf but changing the extension to .dwf works too.
Changing the top line from:
oPath = "C:\Dwf"
to:
oPath = "%userprofile%\documents\Dwf"
doesn't work.
I'd like the save destination to be here:
The user's can't save to the C\: drive just to their profile.
The plan is to run the code as an external rule across the network.
Multiple users being able to save as locally.
Thanks
Andrew
Solved! Go to Solution.