Thread: Input box
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
sebastienm sebastienm is offline
external usenet poster
 
Posts: 694
Default Input box

Hi
You can either force it to a text:
'---------------------------------------------------------------------
Sub test()
Dim s As String
s = Application.InputBox("Enter file number", "File", , , , , , 2)
MsgBox s
' add code for case s="False" ie user clicked Cancel
End Sub
'-----------------------------------------------------------------------
or, if numbers are 3-digit long for sure, format explicitely the output (v
in thsi exmaple):
v=strings.format(v,"000") ' force to 3-digit
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"hshayh0rn" wrote:

I have an input box that my users put a number in. The number is then used
throught my macro to identify a file. Eveything works fine until the user
enters a number like 089 or 054. If there is a preceeding zero in the number
the zero is dropped off and the macro then trys to use 89 or 54 as the
inputed nunber. How can I keep the zero?