ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User prompt - Open file - Perform action (https://www.excelbanter.com/excel-programming/358582-user-prompt-open-file-perform-action.html)

erikhs[_4_]

User prompt - Open file - Perform action
 

Hello,

I have a progam that performs certain database actions on a csv file
(f.x. transforms to excel, rearranges, copy-pastes, creates new
processed file).
For this to work i have up until now required the user to save this csv
file as a specified constant filename so that the code recognizes it.
The code is something like: Workbooks("csvfile.csv").activate. What i
would rather do is make some kind of prompt, where the user can choose
what file to process, a.k.a i want the user too choose from a standard
windows "open file" window, preferable with some kind of standard path.
When VBA has the opened this file, i think activesheet will be enough
the rest of the process. Do you have any suggestions?


--
erikhs
------------------------------------------------------------------------
erikhs's Profile: http://www.excelforum.com/member.php...o&userid=32788
View this thread: http://www.excelforum.com/showthread...hreadid=531857


Xcelion

User prompt - Open file - Perform action
 
Hi ,
Use Application.GetOpenFilename method so that user can browse the required
file

Thanks
Xcelion




"erikhs" wrote:


Hello,

I have a progam that performs certain database actions on a csv file
(f.x. transforms to excel, rearranges, copy-pastes, creates new
processed file).
For this to work i have up until now required the user to save this csv
file as a specified constant filename so that the code recognizes it.
The code is something like: Workbooks("csvfile.csv").activate. What i
would rather do is make some kind of prompt, where the user can choose
what file to process, a.k.a i want the user too choose from a standard
windows "open file" window, preferable with some kind of standard path.
When VBA has the opened this file, i think activesheet will be enough
the rest of the process. Do you have any suggestions?


--
erikhs
------------------------------------------------------------------------
erikhs's Profile: http://www.excelforum.com/member.php...o&userid=32788
View this thread: http://www.excelforum.com/showthread...hreadid=531857



erikhs[_5_]

User prompt - Open file - Perform action
 

Thank you very much!

As i am lazy today, could you please tell me if i can have some default
folder to display?


--
erikhs
------------------------------------------------------------------------
erikhs's Profile: http://www.excelforum.com/member.php...o&userid=32788
View this thread: http://www.excelforum.com/showthread...hreadid=531857


Tom Ogilvy

User prompt - Open file - Perform action
 
chdrive "C"
Chdir "C:\MyFolder"
fname = Appliction.GetOpenFileName()

--
Regards,
Tom Ogilvy



"erikhs" wrote:


Thank you very much!

As i am lazy today, could you please tell me if i can have some default
folder to display?


--
erikhs
------------------------------------------------------------------------
erikhs's Profile: http://www.excelforum.com/member.php...o&userid=32788
View this thread: http://www.excelforum.com/showthread...hreadid=531857



erikhs[_6_]

User prompt - Open file - Perform action
 

Thank you! As always this forum is fast and reliable!


--
erikhs
------------------------------------------------------------------------
erikhs's Profile: http://www.excelforum.com/member.php...o&userid=32788
View this thread: http://www.excelforum.com/showthread...hreadid=531857



All times are GMT +1. The time now is 02:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com