Input box

O

Oldjay

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
 
D

Dave Peterson

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.
 
O

Oldjay

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
 
D

Dave Peterson

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
 
D

Dave Peterson

Open excel
Open your workbook
Go into the VBE
Select your project
Tools|References
Look for MISSING reference.

Uncheck that missing reference.

The missing reference may not (usually doesn't) have anything to do with the
line that caused the error.
Dave I get a compile error with Trim highlighted "can't find project or libary
 
O

Oldjay

That got rid of the error message but
after I select 1 or 2 I want that path in the message box so that I can just
type in a file name to open
 
D

Dave Peterson

You got that path in the message box.

I don't understand your question.
That got rid of the error message but
after I select 1 or 2 I want that path in the message box so that I can just
type in a file name to open
 

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

Similar Threads

On Error 6
Placing cursor in message box 1
Finding a file 6
Ehandler 1
Error Message 3
ehandler 2
Input box 1
Creating a path to save a file 5

Top