To all,
I am new to Laserfiche and Workflow. I have to jump into the deep end for my first project. I am cleaning up a mess, and I can’t budget for Workflow add-ons this physical year. I need to get this one project completed.
A program will drop files on a network share.
Example: \\parkvcapp\ProjectXfer
This is an example file name:
PERMIT_CRW^1309050730020011_BRES2013-00102_Expired Letter Sample.pdf
My CRW (Import) Template is: CRW Import
Fields:
- CRW Module
- CRW ID (The leading CRW^ is trimmed off below)
- Permit #
- Document Type
I have written VBA code to:
- Access a UNC Folder
- Process each file in the folder
- Process each file name to extract the template info
Bradley Eudy has a nice piece of code showing how to use Document Importer at:
https://answers.laserfiche.com/questions/50749/import-document-ASPnet-Code
I still need some help using my code to bring the documents into Laserfiche and update the metadata (template).
Thank you in advance.
Code:
Option Explicit
Sub Iterate_Files()
Dim ctr As Integer
Dim i As Integer
Dim CRW_Module As String
Dim CRW_ID As String
Dim CRW_CASE_No As String
Dim CRW_Filename As String
Dim WrdArray() As String
Dim text_string As String
Dim Path As String
Dim File As String
ctr = 1
Path = "\\parkvcapp\ProjectXfer\"
' Path should always contain a '\' at end
File = Dir(Path) ' Retrieving the first entry.
Do Until File = "" ' Start the loop.
' text_string = Path & File ' If path and file is needed.
text_string = File
WrdArray() = Split(text_string, "_")
CRW_Module = WrdArray(0)
CRW_ID = WrdArray(1)
CRW_ID = Mid(CRW_ID, 5) 'Trims the "CRW^" off the ID
CRW_CASE_No = WrdArray(2)
CRW_Filename = WrdArray(3)
' Tested in Excel, the following 4 lines are not used here.
' ActiveSheet.Cells(ctr, 1).Value = CRW_Module
' ActiveSheet.Cells(ctr, 2).Value = CRW_ID
' ActiveSheet.Cells(ctr, 3).Value = CRW_CASE_No
' ActiveSheet.Cells(ctr, 4).Value = CRW_Filename
ctr = ctr + 1
File = Dir() ' Getting next entry.
Loop
End Sub