PDA

View Full Version : Detect the Excel File Name in Visual Basic


wilbasket168
05-18-2004, 07:26 PM
how can i program in Visual Basic Application so every time when i run my program it will first detect the Excel file name and then pass the file name parameter into different module. how would i be able to achieve this.

brouse
05-19-2004, 09:58 PM
This is a little vague. I assume you mean there is a single Excel file in a folder somewhere and you need to get its full name. You could do this:

Dim strPath as string
Dim strExcelFile as string

' Change this if the folder is different than your application
strPath = app.Path

' Get the file name
strExcelFile = Dir(strPath & "\*.XLS")

I'm not sure what you mean by pass it to another module...

Bob