ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Input box (https://www.excelbanter.com/excel-discussion-misc-queries/176065-input-box.html)

Oldjay

Input box
 
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

Input box
 
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

Oldjay

Input box
 
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

Input box
 
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

Oldjay

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


Dave Peterson

Input box
 
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.

Oldjay wrote:

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


--

Dave Peterson

Oldjay

Input box
 
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

"Dave Peterson" wrote:

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.

Oldjay wrote:

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


--

Dave Peterson


Dave Peterson

Input box
 
You got that path in the message box.

I don't understand your question.

Oldjay wrote:

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

"Dave Peterson" wrote:

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.

Oldjay wrote:

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


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 07:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com