You are correct about your first two assumptions. I'm writing an equal number of vars across the whole operation.
Excel is closing separately from VBA. VBA is not causing Excel to close, PAD is.
Beginning of the Flow
Here PAD is targeting the drop folder and taking all of the files into %Files% and doing that counter-set-to-zero thing you mentioned.
Beginning of the For-Each file breakdown into Vars
This is showing some of the file name processing that I'm doing. Its a little messy lmfao.
Open Excel, attach, close, release Excel. Double check to make sure all files that can be iterated have been.
This screenshot shows how many vars I end up with when I'm done processing the file names for VBA.
@MichaelAnnis wrote:
So, I want to make sure I understand.
Step 1 - get all email attachments and save to a folder
Step 2 - use Get Files on the folder, now I have %Files% where each file in Files is a full path/filename
Step 3 - you are using Parse Text to extract variables from the filename
This final screen shot is step 3 you mentioned. I have all 5 vars and I'm ready to send them to VBA at that point. Anything that has fewer than 5 vars has been punted and is not included in the final list of vars/files.
@MichaelAnnis wrote:
As far as parsing out all your filenames to separate variables, the short answer is "yes". Assuming they all have the same amount of variables:
Get Files
Add list (VarList1)
Add list (VarList2)
Add list (VarList3)
For each CurrentItem in Files
Parse Text to Var1, Var2, and Var3
Add Item to List Var1 to VarList1
Add Item to List Var2 to VarList2
Add Item to List Var3 to VarList3
End For Each
Can you explain this to me a little more? I'm still pretty new to these programming/code language concepts like var lists and adding items to lists. In my current method I take the file apart piece by piece, starting left and going right. Please make corrections where you see fit: I take the For Each containing all of the Files and iterate each piece of the file name, like I am now, into its own unique var. This is where I'm getting confused. Now that I have a unique var, I need to add it to one of four lists. (It will be apparent which list to add to) Am I continuously adding a new var by replacing the contents in the new iteration of the For-Each that goes over file names? If so, is that why you worded it, "Add Item to List Var1 to VarList1" (IE, Add %FirstName% to %FirstNameList%, later Add %LastName% to %LastNameList%?)
When there are no more files to iterate that must be the logical end of the For-Each, at which point I can send these lists of Vars to VBA?
Do I need to consider what VBA is expecting as incoming vars? (I'm not sure how to word this question well.)
Sub SorterMain(FirstName As String, LastName As String, DateMatch As String, F2F As String, MonthVal As String)
Where "FirstName as String" is the incoming var, do I need to adapt this to the fact that it is now receiving a list and not a single string?
Thank you sincerely for your assistance, @MichaelAnnis !!!