ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   two small questions (https://www.excelbanter.com/excel-programming/350160-two-small-questions.html)

dok112[_77_]

two small questions
 

1. How would I write this code? I need a workbook to not close using
the X in the top right corner. I want it to put up an error message
saying to use the Exit button. I know how to do the message box, but
when I try using the beforeclose call, I cant figure out how to write
code to stop the procedure once it's started. just a plain exit sub
doesnt work...

and

2. Is there a way, to have a textbox, that the user will click on a
button next to it, and it will open up a "explorer" box for them to
search for a file. Basically, I need something that will let them
select a file, and it's going to put the direct link (C:\windows\...)
in a textbox. Is this possible? I'm sure it is, I just don't know how
to do it.

Thanks everyone for your help...


--
dok112
------------------------------------------------------------------------
dok112's Profile: http://www.excelforum.com/member.php...o&userid=10581
View this thread: http://www.excelforum.com/showthread...hreadid=500430


RB Smissaert

two small questions
 
First one:
Cancel = True

Second one:
Lookup this one in the help: Application.GetOpenFilename

RBS

"dok112" wrote in
message ...

1. How would I write this code? I need a workbook to not close using
the X in the top right corner. I want it to put up an error message
saying to use the Exit button. I know how to do the message box, but
when I try using the beforeclose call, I cant figure out how to write
code to stop the procedure once it's started. just a plain exit sub
doesnt work...

and

2. Is there a way, to have a textbox, that the user will click on a
button next to it, and it will open up a "explorer" box for them to
search for a file. Basically, I need something that will let them
select a file, and it's going to put the direct link (C:\windows\...)
in a textbox. Is this possible? I'm sure it is, I just don't know how
to do it.

Thanks everyone for your help...


--
dok112
------------------------------------------------------------------------
dok112's Profile:
http://www.excelforum.com/member.php...o&userid=10581
View this thread: http://www.excelforum.com/showthread...hreadid=500430



dok112[_78_]

two small questions
 

thanks for the answer to the first one.

for 2, I dont want it to open the file. I just want it to put the path
for it. What I'm trying to do, is write a macro that is going to run
down a list of these and email the file at that path to the person in
A1....


--
dok112
------------------------------------------------------------------------
dok112's Profile: http://www.excelforum.com/member.php...o&userid=10581
View this thread: http://www.excelforum.com/showthread...hreadid=500430


dok112[_79_]

two small questions
 

I GOT IT!! WOO HOO!! Thank you!!


--
dok112
------------------------------------------------------------------------
dok112's Profile: http://www.excelforum.com/member.php...o&userid=10581
View this thread: http://www.excelforum.com/showthread...hreadid=500430


RB Smissaert

two small questions
 
You don't have to open the file and you can just get the file path:

strFilePath = _
Application.GetOpenFilename(FileFilter:="Text Files (*.txt), *.txt",
_
Title:="Point to a text file")

MsgBox strFilePath

You also could use this one:

vDialogResult = _
Application.GetSaveAsFilename(InitialFileName:=str DefaultFilePath, _
FileFilter:="Text Files (*.txt),
*.txt")


RBS

"dok112" wrote in
message ...

thanks for the answer to the first one.

for 2, I dont want it to open the file. I just want it to put the path
for it. What I'm trying to do, is write a macro that is going to run
down a list of these and email the file at that path to the person in
A1....


--
dok112
------------------------------------------------------------------------
dok112's Profile:
http://www.excelforum.com/member.php...o&userid=10581
View this thread: http://www.excelforum.com/showthread...hreadid=500430




All times are GMT +1. The time now is 10:40 PM.

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