VB equivalent in Studio 2005 - FollowHyperlink (opening files)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In the old days of Visual Basic for Applications, I successfully opened a
file (of any file type: .dwg .pdf .doc etc) in its own application using:

ActiveWorkbook.FollowHyperlink Address:=filepath, NewWindow:=True

I don't want to read/write the file, nor to display FileDialog, I just want
to open a named file it in its own application (usually Adobe.pdf).
In Visual Studio 2005 I can successfully find the file using wildcards in:

My.Computer.FileSystem.GetFiles

but neither of the following will open the file or report an error:

System.IO.File.Open(filepath, IO.FileMode.Open)
Microsoft.VisualBasic.FileOpen(1, filepath, OpenMode.Random)

Presumably, I am not using the appropriate Method. Probably the answer's
simple, can anyone help, please?
 
DF,

Open a file is in my idea a kind in my idea misplaced term still existing
from the tapereader. You want to read a file from disk I assume, but than
the application has to use it.

Mostly that what is readed using file access is a string. It can as well be
a part of a special application. But than has the application like Office as
you showed the code to do that.

Reading a file is mostly using the streamreader.
http://windowssdk.msdn.microsoft.com/en-us/library/system.io.streamreader.aspx

I hope this helps something,

Cor
 
Her you open as if you wanted to read/write the file content.

You have actually to "launch" the file i.e. the associated application will
launch and will open the file. See Process.Start...
 
Back
Top