I made a VBA macro for Outlook to scan the text of an email, pull out part numbers, and display a dialog box listing the results to allow the user to automatically attach a matching DXF or PDF file from our server. Reading the text, matching the regex, etc., all goes fine. However many files that do exist in the proper location with the proper name are not attached. It's like I have to manually view them in Windows before the macro can see them.
How do I make it so it can see all the files in my vault without manually *Getting* them through PDM or Windows? I attached my Macro code and form, it's fairly simple, here's the part where I try to get the files:
Sub GetPDMFiles(Optional pdfFile As String = "", Optional dxfFile As String = "")
Dim i As Integer
i = 0
If pdfFile <> "" Then
foldersToGet(i).mlDocID = vault.GetFileFromPath(pdfFile).iD
foldersToGet(i).mlProjID = vault.GetFolderFromPath(pdfDir).iD
i = i + 1
End If
If dxfFile <> "" Then
foldersToGet(i).mlDocID = vault.GetFileFromPath(dxfFile).iD
foldersToGet(i).mlProjID = vault.GetFolderFromPath(dxfDir).iD
i = i + 1
End If
fileGetter.AddSelection vault, foldersToGet
fileGetter.CreateTree 0, EdmGetCmdFlags.Egcf_Nothing
fileGetter.GetFiles 0, Nothing
End Sub
SolidworksApi/macros