• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Browse excel file

coolkiran

Member
Hello

I have one macro code to browse excel file, that works perfectly,

Now my query is, Is there any code in macro, from that we can see the sheet name of browsed excel file in runtime. Because After i knowing the sheet name, then only i can execute my code further. [Once i know the sheet name, i have to enter that sheet name to one input box, after some calculation will execute to that particular sheet]

Kiran
 
Hi, coolkiran!
This question is somehow alike this one:
http://chandoo.org/forum/threads/ho...thout-opening-an-excel-file.11887/#post-69729
In what sense? In this last case both the solutions posted from other sites and the one I posted, they all opened the file, maybe not from Excel application, but opened it anyway, otherwise there's no Windows function that retrieves the information asked.
In this case the solution pointed from mrexcel's site is as tricky and dirty and false (regarding not opening the file) as the three previous.
Regards!
 
Hi Coolkiran,

My requiremnt is exactly same what you have and what you have mentioned in your thread opening line. Can you please share the VBA code to browse the file path for opening the xls/csv file through vba code.

Thanks in advance for the same.

Shweta
 
Hi smittal

Try this

Code:
vFile = Application.GetOpenFilename("Excel-files,*.*", _
    1, "Select One File To Open", , False)

'if the user didn't select a file, exit sub
If TypeName(vFile) = "Boolean" Then Exit Sub
Workbooks.Open vFile
 
Back
Top