help with manipulating string and open dialog box

F

funkymonkUK

hi i got the following code

Sub test

Dim xlbookPath as string

xlbookPath = Application.getopenfilename ("Excel Files(*.xls),*.xls")

Msgbox xlbookPath

end sub

Now i have two questions first one.

1. With the Getopenfilename settings Can I specify the title of the
open box the default is "Open" but I want to change this how do I do
it.

2. xlbookPath is a whole long string I want to remove the .xls part of
the string which will be right at the end of the string. ANY IDEAS HOW
I COULD DO THIS?
 
N

NickHK

funkymonkUK,
Look at the 3rd argument, the optional "Title".

To strip the last 4 characters use
= Left(xlbookPath, Len(xlbookPath) - 4)

By the way, you should check that the Cancel was not clicked, rather than
OK.

NickHK

"funkymonkUK" <[email protected]>
wrote in message
news:[email protected]...
 
F

funkymonkUK

thanks for that. but how do i incorporate the "title" option into m
code. I have made sure about the cancel button by saying that i
xlbookpath=false or xlbookpath = empty then exit sub
 
N

NickHK

funkymonkUK,
If you had read the help, you would have seen:
<From Help>
GetOpenFilename Method

Displays the standard Open dialog box and gets a file name from the user
without actually opening any files.
Syntax
expression.GetOpenFilename(FileFilter, FilterIndex, Title, ButtonText,
MultiSelect)
........
Title Optional Variant. Specifies the title of the dialog box. If this
argument is omitted, the title is "Open."
.....
</From Help>

NickHK

"funkymonkUK" <[email protected]>
wrote in message
news:[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top