help with manipulating string and open dialog box

  • Thread starter Thread starter funkymonkUK
  • Start date Start date
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?
 
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]...
 
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
 
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]...
 
Back
Top