Hi,
I'm so confused to show message based on this line
MsgBox "File not found for selection= " & FileRoot
after open file !
the file is lready existed and will open it , so the correct procedure should not show message!
what's wrong guys?!
Hi,
I'm so confused to show message based on this line
MsgBox "File not found for selection= " & FileRoot
after open file !
the file is lready existed and will open it , so the correct procedure should not show message!
what's wrong guys?!
Speed, sorry but I'm away from my PC for several hours now (and can't check macros on my phone).
In my previous Answer to you, I asked you to ensure that the line:
Dim i As Long
is at the top of the module behind your UserForm (i.e. it is the very first line, before any codes). That way its value is kept between the main procedure and the function (and iterative calls of that function).
I suspect that is the cause of your problem - please check that this is the case.
REVISION #1, 04 June 2025 -
The problem arises since the Function code on the previous Answer open files in all of folders branches in directory (now corrected) omitted the lines in bold below in the code extract:
' check again for a pdf of that name
Fname = Dir(fldFolder & "\" & fRoot & ".pdf")
If Fname <> "" Then
' try to open pdf
ActiveWorkbook.FollowHyperlink fldFolder & "\" & Fname
' increment the "found" counter
i = i + 1
End If
Hope this corrects the problem- if so, please remember to mark this Answer as Selected.
If Fname <> "" Then
i =i + 1
' try to open pdf
ActiveWorkbook.FollowHyperlink fldFolder & "\" & Fname
End If