Hi Zhen, Managed to get around to play with this code works a well thanks, would there be way to export the file names into spreadsheet, which is arranged by the suffix name like PC or MA etc also the title of the drawing (name) e.g 411-001-001 Mounting bracket
One way to get this to work is by recording the file name when it is transversing and exporting the PDF
As i have a hard time figuring out my own reply on the old forum, i will just post some pseudo code for now (i also cant find my own archive folder as they remove the old forum thread number which i use to archive my reply
)
The idea is to concatenating vbNEwLine with the file name and the custom property to produce a txt/csv file at the end of macro that can be imported using excel.
At the start of macro (before transversing the assembly), add the following code
you could adjust the txt name to use the hla name too
Code: Select all
Dim Log As String
Dim fsW As Object
Dim tsW As Object
Dim TxtName As String
Dim LogPath As String
Log = "Files Exported: " & vbNewLine
TxtName = "Log.txt"
After SaveAs command (before transversing to the next component), add the following code
You can further adjust the code to create a comma separated file,
Code: Select all
Log = Log & [FileName] &","& [CustomProperty]& vbNewLine
After finishing all export (before ending the macro), add the following code
Code: Select all
LogPath = [logPathFolder] & TxtName
Set fsW = CreateObject("Scripting.FileSystemObject")
Set tsW = fsW.CreateTextFile(LogPath, True)
tsW.writeline (Log)
tsW.Close
syntax in [bracket] need to be adjusted to the appropriate variable used in the macro
Far too many items in the world are designed, constructed and foisted upon us with no understanding-or even care-for how we will use them.