Choose a file VS2017

  • Thread starter Thread starter Scott77_77
  • Start date Start date
S

Scott77_77

Guest
Hi Guys,

left this as one of the last bits of my project to come back to as thought it would be easy and Ive spent over a day on it so need to ask for help please.

The need is for a user to be able to select a file and the path and file name to be stored in a string without the actual file opening up. Simple enough ask I thought using the 'Openfiledialog'. I use this in other place with code such as:


Dim t As String = "Excel Files|*.xls;*.xlsx;*.xlsm"
Dim fd = New OpenFileDialog()
fd.Title = "Choose File"
fd.Multiselect = False
fd.InitialDirectory = "C:\"
fd.Filter = t
fd.FilterIndex = 2
fd.RestoreDirectory = True


(Yep it can be simplified)


The issue I have is when an excel workbook is password protected, once I choose the file it opens excel and prompts for the password. Is there anyway to just choose the file, return the file info on a password protected file without it opening or prompting for the password.

Would really appreciate some help as a day of googling, playing with code and trying to convert some old VBA just ha not helped.

Kind Regards

Scott

Continue reading...
 
Back
Top