How do you check for value "<Path not found>"

crewaustin66

Board Regular
Joined
Jun 11, 2014
Messages
82
I have some VBA code that exports the source code to a file. The following statement is giving me a problem:

if len(vbproj.Collection(i).fileName)>0 then
'Do something
end if

Unfortunately, looking at the vbproj object I find that vbproj.FileName shows in the watch box as Path not found
. It says that is an integer but it doesn't show a value.

How can I test for this "value" so that I can use it in an IF/END IF?

Thanks,
Crew</path>
 
Last edited:

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Code:
  Dim sFile         As String

  On Error Resume Next

  ' ...
  sFile = vbproj.Collection(i).Filename
  If Err.Number Then
    Err.Clear
    ' do something
  Else
    ' do something else
  End If
  ' ...
 
Last edited:
Upvote 0
Thanks for the shg. I found a different solution since posting that. I'll post it here for others to find as well.
Code:
    Set vbproj = Workbooks(projectFileName).VBProject
    tn = vbproj.Collection(projectName).fileName
    If VarType(tn) <> 8 Then Exit Function ' Bad project filename = <Path not found>
</path>
 
Last edited:
Upvote 0

Forum statistics

Threads
1,222,689
Messages
6,167,648
Members
452,127
Latest member
jayneecm

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top