excel - How to display the filename selected by a user in a label -
i'm creating basic csv file analysis tool in excel using vba (which have started learning).
my question is: how label display name of file user has selected using button?
below code have button:
sub csv_import() dim ws worksheet, filenm string set ws = activeworkbook.sheets("csv data") filenm = application.getopenfilename("csv files (*.csv),*.csv", , "please select csv file...") if filenm = "false" exit sub else ws.querytables.add(connection:="text;" & filenm, destination:=ws.range("a1")) .textfileparsetype = xldelimited .textfilecommadelimiter = true .refresh end end if end sub
i have tried creating label , using label1.caption = filenm
keep getting object not exist error (which kind of expected). apologies if basic fix appreciated.
Comments
Post a Comment