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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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