Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Getting a String Path from a browser...

Hi all...

Is there a way in VBA to get a path in string format out
of a browser dialog box?... similar to an inputbox that
includes a *browse* button???

Any help is greatly appreciated...

Regards
Juan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Getting a String Path from a browser...

Take a look at the GetOpenFileName method.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Juan Sanchez" wrote in message
...
Hi all...

Is there a way in VBA to get a path in string format out
of a browser dialog box?... similar to an inputbox that
includes a *browse* button???

Any help is greatly appreciated...

Regards
Juan



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Getting a String Path from a browser...

Bob/Andy

Thanks!
Both of your suggestions work great, exept that i need to
get a file selected at the end... It does not allow me to
select a folder. I found sort of what I'm looking for he

http://support.microsoft.com/default...d=kb;es;550902

its in spanish, but the code works fine... it messes with
dll's functions and custom types and some other stuff I
don't understand and have never used...

Simply using the code works great but I don't like to use
things I don't understand... I never know when they'll
fail...

If you know of something simpler to do the same I would
appreciate it...

Regards
JS


-----Original Message-----
Take a look at the GetOpenFileName method.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Juan Sanchez" wrote in

message
...
Hi all...

Is there a way in VBA to get a path in string format out
of a browser dialog box?... similar to an inputbox that
includes a *browse* button???

Any help is greatly appreciated...

Regards
Juan



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Getting a String Path from a browser...

Hi Juan,

I think you will find that Bob's suggestion does what you want.

For example, the following allows you to browse for a folder and open a
selected file:

Sub Test()
Dim fname As Variant

fname = Application.GetOpenFilename

Workbooks.Open fname

End Sub

---
Regards,
Norman


"Juan Sanchez" wrote in message
...
Bob/Andy

Thanks!
Both of your suggestions work great, exept that i need to
get a file selected at the end... It does not allow me to
select a folder. I found sort of what I'm looking for he

http://support.microsoft.com/default...d=kb;es;550902

its in spanish, but the code works fine... it messes with
dll's functions and custom types and some other stuff I
don't understand and have never used...

Simply using the code works great but I don't like to use
things I don't understand... I never know when they'll
fail...

If you know of something simpler to do the same I would
appreciate it...

Regards
JS


-----Original Message-----
Take a look at the GetOpenFileName method.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Juan Sanchez" wrote in

message
...
Hi all...

Is there a way in VBA to get a path in string format out
of a browser dialog box?... similar to an inputbox that
includes a *browse* button???

Any help is greatly appreciated...

Regards
Juan



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Getting a String Path from a browser...

Thanks Norman, I re-read my own post and found that it was
a confusing one and does not represent what I'm looking
for... Bob's, Andy's and your own suggestions finish in
selecting a FILE, I do not want to retreive a FILE I want
to retreive just a FOLDER where I will later on the sub
save something...

I hope I have explained myself... cheers Juan

-----Original Message-----
Hi Juan,

I think you will find that Bob's suggestion does what you

want.

For example, the following allows you to browse for a

folder and open a
selected file:

Sub Test()
Dim fname As Variant

fname = Application.GetOpenFilename

Workbooks.Open fname

End Sub

---
Regards,
Norman


"Juan Sanchez" wrote in

message
...
Bob/Andy

Thanks!
Both of your suggestions work great, exept that i need

to
get a file selected at the end... It does not allow me

to
select a folder. I found sort of what I'm looking for

he

http://support.microsoft.com/default.aspx?

scid=kb;es;550902

its in spanish, but the code works fine... it messes

with
dll's functions and custom types and some other stuff I
don't understand and have never used...

Simply using the code works great but I don't like to

use
things I don't understand... I never know when they'll
fail...

If you know of something simpler to do the same I would
appreciate it...

Regards
JS


-----Original Message-----
Take a look at the GetOpenFileName method.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"Juan Sanchez" wrote in

message
...
Hi all...

Is there a way in VBA to get a path in string format

out
of a browser dialog box?... similar to an inputbox

that
includes a *browse* button???

Any help is greatly appreciated...

Regards
Juan


.



.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Getting a String Path from a browser...

Hi Juan,

In that case, try:

Sub Test9a()
Dim fname As Variant
Dim dirName As String

fname = Application.GetOpenFilename

Debug.Print InStrRev(fname, "\")
dirName = Left(fname, InStrRev(fname, "\"))
Debug.Print dirName

End Sub


"Juan Sanchez" wrote in message
...
Thanks Norman, I re-read my own post and found that it was
a confusing one and does not represent what I'm looking
for... Bob's, Andy's and your own suggestions finish in
selecting a FILE, I do not want to retreive a FILE I want
to retreive just a FOLDER where I will later on the sub
save something...

I hope I have explained myself... cheers Juan

-----Original Message-----
Hi Juan,

I think you will find that Bob's suggestion does what you

want.

For example, the following allows you to browse for a

folder and open a
selected file:

Sub Test()
Dim fname As Variant

fname = Application.GetOpenFilename

Workbooks.Open fname

End Sub

---
Regards,
Norman


"Juan Sanchez" wrote in

message
...
Bob/Andy

Thanks!
Both of your suggestions work great, exept that i need

to
get a file selected at the end... It does not allow me

to
select a folder. I found sort of what I'm looking for

he

http://support.microsoft.com/default.aspx?

scid=kb;es;550902

its in spanish, but the code works fine... it messes

with
dll's functions and custom types and some other stuff I
don't understand and have never used...

Simply using the code works great but I don't like to

use
things I don't understand... I never know when they'll
fail...

If you know of something simpler to do the same I would
appreciate it...

Regards
JS


-----Original Message-----
Take a look at the GetOpenFileName method.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"Juan Sanchez" wrote in
message
...
Hi all...

Is there a way in VBA to get a path in string format

out
of a browser dialog box?... similar to an inputbox

that
includes a *browse* button???

Any help is greatly appreciated...

Regards
Juan


.



.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Getting a String Path from a browser...

Juan,

The GetOpen method does allow you to select a folder, but not just a folder.
Is that what you mean? If so, I would have given you very similar code to
that article. Don't worry it won't break.

If you have XL2002 or later, there is a folder browser dialog.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Juan Sanchez" wrote in message
...
Bob/Andy

Thanks!
Both of your suggestions work great, exept that i need to
get a file selected at the end... It does not allow me to
select a folder. I found sort of what I'm looking for he

http://support.microsoft.com/default...d=kb;es;550902

its in spanish, but the code works fine... it messes with
dll's functions and custom types and some other stuff I
don't understand and have never used...

Simply using the code works great but I don't like to use
things I don't understand... I never know when they'll
fail...

If you know of something simpler to do the same I would
appreciate it...

Regards
JS


-----Original Message-----
Take a look at the GetOpenFileName method.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Juan Sanchez" wrote in

message
...
Hi all...

Is there a way in VBA to get a path in string format out
of a browser dialog box?... similar to an inputbox that
includes a *browse* button???

Any help is greatly appreciated...

Regards
Juan



.



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Getting a String Path from a browser...

Bob...

Yes, that is what I ment. Thanks alot... I am using it...
actually I wanted it for an Outlook macro, and it is
working fine... If you use outlook you'll know the pain of
detaching various attachments... like when someone sends
you a bunch of pictures, I have overcome that... I posted
in the outlook group but is not as attended as this one
and I though that VBA is VBA and somethings can work on
any program... Thanks!

I use XL2000 in the office that is where I really need the
macros, but have XP at Home, is the folder dialog you
mention shorter and simpler that the one on the article?
can you tell me where to look so that I learn how to code
it?... thanks in advance...

Juan




-----Original Message-----
Juan,

The GetOpen method does allow you to select a folder, but

not just a folder.
Is that what you mean? If so, I would have given you very

similar code to
that article. Don't worry it won't break.

If you have XL2002 or later, there is a folder browser

dialog.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Juan Sanchez" wrote in

message
...
Bob/Andy

Thanks!
Both of your suggestions work great, exept that i need

to
get a file selected at the end... It does not allow me

to
select a folder. I found sort of what I'm looking for

he

http://support.microsoft.com/default.aspx?

scid=kb;es;550902

its in spanish, but the code works fine... it messes

with
dll's functions and custom types and some other stuff I
don't understand and have never used...

Simply using the code works great but I don't like to

use
things I don't understand... I never know when they'll
fail...

If you know of something simpler to do the same I would
appreciate it...

Regards
JS


-----Original Message-----
Take a look at the GetOpenFileName method.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"Juan Sanchez" wrote in

message
...
Hi all...

Is there a way in VBA to get a path in string format

out
of a browser dialog box?... similar to an inputbox

that
includes a *browse* button???

Any help is greatly appreciated...

Regards
Juan


.



.

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Getting a String Path from a browser...

Juan,

Much shorter, much simpler.

I don't use 2002 myself, so you may need to play with this, but this is
basically it

With Application.FileDialog(msoFileDialogFolderPicker)
.Show

MsgBox .SelectedItems(1)

End With

Look up FileDialog in the VBA help

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Juan Sanchez" wrote in message
...
Bob...

Yes, that is what I ment. Thanks alot... I am using it...
actually I wanted it for an Outlook macro, and it is
working fine... If you use outlook you'll know the pain of
detaching various attachments... like when someone sends
you a bunch of pictures, I have overcome that... I posted
in the outlook group but is not as attended as this one
and I though that VBA is VBA and somethings can work on
any program... Thanks!

I use XL2000 in the office that is where I really need the
macros, but have XP at Home, is the folder dialog you
mention shorter and simpler that the one on the article?
can you tell me where to look so that I learn how to code
it?... thanks in advance...

Juan




-----Original Message-----
Juan,

The GetOpen method does allow you to select a folder, but

not just a folder.
Is that what you mean? If so, I would have given you very

similar code to
that article. Don't worry it won't break.

If you have XL2002 or later, there is a folder browser

dialog.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Juan Sanchez" wrote in

message
...
Bob/Andy

Thanks!
Both of your suggestions work great, exept that i need

to
get a file selected at the end... It does not allow me

to
select a folder. I found sort of what I'm looking for

he

http://support.microsoft.com/default.aspx?

scid=kb;es;550902

its in spanish, but the code works fine... it messes

with
dll's functions and custom types and some other stuff I
don't understand and have never used...

Simply using the code works great but I don't like to

use
things I don't understand... I never know when they'll
fail...

If you know of something simpler to do the same I would
appreciate it...

Regards
JS


-----Original Message-----
Take a look at the GetOpenFileName method.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"Juan Sanchez" wrote in
message
...
Hi all...

Is there a way in VBA to get a path in string format

out
of a browser dialog box?... similar to an inputbox

that
includes a *browse* button???

Any help is greatly appreciated...

Regards
Juan


.



.



  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Getting a String Path from a browser...

Bob... thanks... is is certainly MUCH simpler...

Juan


-----Original Message-----
Juan,

Much shorter, much simpler.

I don't use 2002 myself, so you may need to play with

this, but this is
basically it

With Application.FileDialog(msoFileDialogFolderPicker)
.Show

MsgBox .SelectedItems(1)

End With

Look up FileDialog in the VBA help

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Juan Sanchez" wrote in

message
...
Bob...

Yes, that is what I ment. Thanks alot... I am using

it...
actually I wanted it for an Outlook macro, and it is
working fine... If you use outlook you'll know the pain

of
detaching various attachments... like when someone sends
you a bunch of pictures, I have overcome that... I

posted
in the outlook group but is not as attended as this one
and I though that VBA is VBA and somethings can work on
any program... Thanks!

I use XL2000 in the office that is where I really need

the
macros, but have XP at Home, is the folder dialog you
mention shorter and simpler that the one on the article?
can you tell me where to look so that I learn how to

code
it?... thanks in advance...

Juan




-----Original Message-----
Juan,

The GetOpen method does allow you to select a folder,

but
not just a folder.
Is that what you mean? If so, I would have given you

very
similar code to
that article. Don't worry it won't break.

If you have XL2002 or later, there is a folder browser

dialog.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"Juan Sanchez" wrote in

message
...
Bob/Andy

Thanks!
Both of your suggestions work great, exept that i

need
to
get a file selected at the end... It does not allow

me
to
select a folder. I found sort of what I'm looking for

he

http://support.microsoft.com/default.aspx?

scid=kb;es;550902

its in spanish, but the code works fine... it messes

with
dll's functions and custom types and some other

stuff I
don't understand and have never used...

Simply using the code works great but I don't like to

use
things I don't understand... I never know when

they'll
fail...

If you know of something simpler to do the same I

would
appreciate it...

Regards
JS


-----Original Message-----
Take a look at the GetOpenFileName method.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"Juan Sanchez" wrote

in
message
...
Hi all...

Is there a way in VBA to get a path in string

format
out
of a browser dialog box?... similar to an inputbox

that
includes a *browse* button???

Any help is greatly appreciated...

Regards
Juan


.



.



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Concatenate path and file string for external reference Michael[_4_] Excel Worksheet Functions 5 May 21st 23 11:44 AM
Relative Path in Connection String Breunus Excel Discussion (Misc queries) 2 July 29th 09 05:10 PM
Stripping Path from File String Nigel[_6_] Excel Programming 15 February 26th 04 06:35 AM
Using a variable string in a file save path Ron[_13_] Excel Programming 1 October 16th 03 08:29 PM
How to get file's current directory path to a string in VBA? [email protected] Excel Programming 1 October 16th 03 07:41 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"