xldialog

  • Thread starter Philipp Oberleitner
  • Start date
P

Philipp Oberleitner

Hello i created a xldialog so that the user can choose a file. Is there a
possibilty so that i get the path lies for example if he opens a file
Test.xls under D:\Test i need to get D:\Test\Test.xls .

Thanks alot in advance
 
N

Norman Jones

Hi Philipp,

Try:

Sub Test2()
Dim fName As Variant
fName = Application.GetOpenFilename
MsgBox fName
'Workbooks.Open fName

End Sub

If you want to open the selected file, uncomment the penultimate line above
 
P

Philipp Oberleitner

Forgot code :

Sub Auto_Open()

Application.Dialogs(xlDialogOpen).Show "F:\Test\Actis Scan"

End Sub


In there i need to get the full path and then close the file again

Thanks
 
B

Bob Phillips

Use GetOpenFileName method instead, it returns a full file name.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
N

Norman Jones

Hi Philipp,

One way:

Sub Test2()
Dim fName As Variant
fName = Application.GetOpenFilename
Test3 fName

End Sub

Sub Test3(Filenme)
Workbooks.Open Filenme
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top