ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Store FilePath Inside Code (https://www.excelbanter.com/excel-programming/370590-store-filepath-inside-code.html)

Magnivy

Store FilePath Inside Code
 
Hello,

I have a macro that pastes data into a file, say File A, from all files in a
specific folder. I'm trying to enhance the macro by having a MessegeBox pop
up before the macro executes that asks whether the uses wants to use a
different folder than the one used previously. If the uses clicks "Yes" on
the MessegeBox, an InputBox pops up that asks the user for the path of the
new file.

The problem is that I if the user clicks "Yes" in the MessegeBox and enters
a new folder in the InputBox, I need to be able to store the path, so that
next time, if the user clicks "No", the macro will know the path to the
previously used folder.

Any help on how to accomplish the above would be greatly appreciated.

Thank You!

Magnivy

Tom Ogilvy

Store FilePath Inside Code
 
http://www.j-walk.com/ss/excel/tips/tip29.htm

can't you write it to a cell, perhaps on a hidden sheet.

--
Regards,
Tom Ogilvy


"Magnivy" wrote:

Hello,

I have a macro that pastes data into a file, say File A, from all files in a
specific folder. I'm trying to enhance the macro by having a MessegeBox pop
up before the macro executes that asks whether the uses wants to use a
different folder than the one used previously. If the uses clicks "Yes" on
the MessegeBox, an InputBox pops up that asks the user for the path of the
new file.

The problem is that I if the user clicks "Yes" in the MessegeBox and enters
a new folder in the InputBox, I need to be able to store the path, so that
next time, if the user clicks "No", the macro will know the path to the
previously used folder.

Any help on how to accomplish the above would be greatly appreciated.

Thank You!

Magnivy


Magnivy

Store FilePath Inside Code
 
That would work too. I just thought that there might be some easy way to
store the path inside the code that I didnt come across.

Thanks for your help!

Magnivy

"Tom Ogilvy" wrote:

http://www.j-walk.com/ss/excel/tips/tip29.htm

can't you write it to a cell, perhaps on a hidden sheet.

--
Regards,
Tom Ogilvy


"Magnivy" wrote:

Hello,

I have a macro that pastes data into a file, say File A, from all files in a
specific folder. I'm trying to enhance the macro by having a MessegeBox pop
up before the macro executes that asks whether the uses wants to use a
different folder than the one used previously. If the uses clicks "Yes" on
the MessegeBox, an InputBox pops up that asks the user for the path of the
new file.

The problem is that I if the user clicks "Yes" in the MessegeBox and enters
a new folder in the InputBox, I need to be able to store the path, so that
next time, if the user clicks "No", the macro will know the path to the
previously used folder.

Any help on how to accomplish the above would be greatly appreciated.

Thank You!

Magnivy


Tom Ogilvy

Store FilePath Inside Code
 


You can modify code with code, but I wouldn't call it easy and if you want
to lock your code, then that isn't an option.

http://www.cpearson.com/excel/vbe.htm

--
Regards,
Tom Ogilvy


"Magnivy" wrote:

That would work too. I just thought that there might be some easy way to
store the path inside the code that I didnt come across.

Thanks for your help!

Magnivy

"Tom Ogilvy" wrote:

http://www.j-walk.com/ss/excel/tips/tip29.htm

can't you write it to a cell, perhaps on a hidden sheet.

--
Regards,
Tom Ogilvy


"Magnivy" wrote:

Hello,

I have a macro that pastes data into a file, say File A, from all files in a
specific folder. I'm trying to enhance the macro by having a MessegeBox pop
up before the macro executes that asks whether the uses wants to use a
different folder than the one used previously. If the uses clicks "Yes" on
the MessegeBox, an InputBox pops up that asks the user for the path of the
new file.

The problem is that I if the user clicks "Yes" in the MessegeBox and enters
a new folder in the InputBox, I need to be able to store the path, so that
next time, if the user clicks "No", the macro will know the path to the
previously used folder.

Any help on how to accomplish the above would be greatly appreciated.

Thank You!

Magnivy



All times are GMT +1. The time now is 12:36 PM.

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