excel vba file filtering to "original filename" -


I am working on a code in Excel VBA, where the user can choose the default route for a file, if he does not Its default path is

I want to filter it, to make sure that it will not select the wrong file.

My idea is to somehow check that "original file name" (which you can see in properties -> details) is like me. This way it will work even when specific file Name should be changed

My problem is, I do not know how to reference it.

Edit

Thanks for the ZAT, the actual code looks like this:

  Private sub vncexe (as vhensxe string) string retarded vncpath2 as vncpath1 dim string Static temppath string vncpath1 = "as in the C: \ Program Files \ RealVNC \ VNC Viewer \ vncviewer.exe" vncpath2 = "C: \ Program Files \ RealVNC \ VNC4 \ vncviewer.exe" dim Opt for String Ob as Opt, then opt = "OB1" then enter (vncpath1) & lt; & Gt; "" Vncexe = vncpath1 ElseIf Dir (vncpath2) & lt; & Gt; "" Then vncexe = vncpath2 ElseIf temppath & lt; & Gt; "" Then vncexe = temppath Else MsgBox "VNC Viewer start exe" to the default path: with Application.FileDialog (msoFileDialogFilePicker) .Title = "Please select false .Filters.Clear .Filters VNC viewer" .InitialView = msoFileDialogViewSmallIcons .AllowMultiSelect =. Add "VNCviewer.exe", "* .exe". Show if Selected items Account & lt; & Gt; 1 again 'should here "or & lt; & gt; [original file name]" Finally else vncexe be = .SelectedItems (1) strVNC = Right (vncexe, 13) so strVNC = "vncviewer.exe" Then temppath = vncexe Otherwise the end result with the end if the end of the end is finished and then end the end of the end, then end the end of the end, then the end of the end is the default "vncpath1" and " Vncpath2 ".  

tempath is a string that we get a new path manually set with this script if the file was not found on "vncpath1" and "vncpath2"

, But my question was, if there is any method, to get the "original file name" of the selected exe and filter it, so it will work only when it is ("in this case)" vncviewer.exe "

, even if I rename the file, the problem with the "original file name" property code is just for ZET Thanks to "vncviewer.exe"

Thanks now if vncviewer.exe example was given to vnc.exe, this will not work, that is why I get the "original filename" property

And because I want to do fancy work: -)

Try it:

  sub filefilterdf () dim strVNC string, vncexe string dim vncpath1 as string as dim vncpath2 Static temppath as string vn cpath1 = "as in the C: \ Program Files \ RealVNC \ VNC Viewer \ vncviewer.exe" Vncpath2 = "C: \ Program Files \ RealVNC \ VNC4 \ vncviewer.exe" 'If Dir (vncpath1) & lt; & Gt; "" Then 'vncexe = vncpath1 & amp; "" 'Elsef der (VNcPit 2) & lt; & Gt; "" Then 'vncexe = vncpath2 & amp; "" 'Elsef Tempath & lt; & Gt; "Then 'vncexe = tempath' other 'msbbx'" VNC viewer is not on the default route "'End &' '' Adjust the placement of code below the loop according to your need: Application.FileDialog (msoFileDialogFilePicker) Title = .InitialView = msoFileDialogViewSmallIcons .AllowMultiSelect = False .Filters.Clear .Filters.Add "VNCviewer.exe" "Please select VNC viewer", "* .exe" .Show .SelectedItems .count  1 Then there should be 'here' or & lt; & gt; [original filename] "and ales vncexe =. Selected Atoms (1) '& amp; "" Do not know why you used the space on strVNC = Right (vncexe, 13) 'The important part' MsgBox strVNC strVNC = vncviewer.exe "Then temppath = vncexe the" MsgBox Temppath Else MsgBox "Wrong File Selected "temppath =" "goto end and end end end end end  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

c# - NewtonSoft JArray - how to select multiple elements with LINQ -

javascript - amcharts makechart not working -