Thread: Input box
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Oldjay Oldjay is offline
external usenet poster
 
Posts: 337
Default Input box

Dave I get a compile error with Trim highlighted "can't find project or libary

"Dave Peterson" wrote:

An inputbox is used to get a value that the user typed in.

I guess you could do something like:

Sub testme()

Dim Folder1 As String
Dim Folder2 As String
Dim resp As String
Dim UseThisOne As String

'your samples weren't different
Folder1 = "\\server3\jobs\estimate1\new_quot1\"
Folder2 = "\\server3\jobs\estimate1\new_quot2\"

UseThisOne = ""
Do
resp = InputBox(Prompt:="1. " & Folder1 & vbLf & _
"2. " & Folder2 & vbLf & _
vbLf & _
"Enter 1 or 2")

Select Case Trim(resp)
Case Is = "1": UseThisOne = Folder1
Case Is = "2": UseThisOne = Folder2
Case Is = "": Exit Do
End Select
If UseThisOne = "" Then
'keep waiting for a valid answer
Else
Exit Do
End If
Loop

If UseThisOne = "" Then
Exit Sub
End If

'show that it worked
MsgBox UseThisOne

End Sub

Oldjay wrote:

I can't understand yoyur message

Maybe I can be a little clear
I want an input box (or something) that will give two options
one that will show a path to one folder
and also a path to another folder

"Dave Peterson" wrote:

Are you trying to open an existing file?

If yes, look at application.getopenfilename in VBA's help:


Dim WkbkName As Variant

WkbkName = Application.GetOpenFilename(filefilter:="Excel files, *.xls")

If WkbkName = False Then
Exit Sub 'user hit cancel
End If

=====
I don't have a network to test this on--you may have to type in the start of the
UNC path to be able to choose deeper levels.

If you map that path to a drive letter, it may be easier to traverse.

Oldjay wrote:

I have an input box with the following code

quotenumber = InputBox("Please enter QUOTE to recall. If you are recalling a
quote from Server3 then type in \\server3\jobs\estimate1\new_quot1\ and the
quote number", "The Auld Company", "C:\quotes\")

I would like to be able to select the another
path"\\server3\jobs\estimate1\new_quot1\" without having to type it in

oldjay

--

Dave Peterson


--

Dave Peterson