thomas häger wrote on 16/01/2013 :
I must be doing something wrong here.
My code so far is:
----
Sub OpenExplorer()
'Open the file with the name specified in the active cell
Dim strThisFile As String
strThisFile = ActiveCell.Value
Dim MyPathFile As String
MyPathFile = Range("F1").Value & strThisFile '"c:\Users\thomas.hager
\Documents\DocLibrary\"
'Application.Dialogs(xlDialogOpen).Show MyPathFile
sFilename = Application.GetOpenFilename
-----
As you can see I tried both suggested versions (commenting one out at
the time). Both alternatives opens up the explorer window but when I
try to actually open a file from this window it does not work. The
explorer window closes but the file does not open. Any ideas here?
Both methods return a filename (including its path), and so you need to
use this as follows...
Workbooks.Open sFilename
OR
Dim WkbSource As Workbook
Set WkbSource = Workbooks.Open(sFilename)
'//do stuff
Set WkbSource = Nothing `//release its memory
**See Isabelle`s solution for an example...
--
Garry
Free usenet access at
http://www.eternal-september.org
Classic
VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.
vb.general.discussion