View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default programming input box

Hi Niocole

Are you sure that an inputbox is the best suited input device for this task
? If I understand what you want then you need three available choices
- select one of the open workbooks from a list;
- select a closed workbook to open in a familiar "open" dialog;
- cancel the operation.
This can easily be done with a userform. Userforms are easy and fun to make
and extremely useful.

And: Don't ever ever ever quit Excel by code. If Excel was running my budget
and you closed it without even a "save changes?" prompt then I'd never touch
your program again.

Best wishes Harald

"Nicole Seibert" skrev i melding
...
I have gotten this far with programming an input box. The box asks for a
file name in which the macro does subsequent processing. I don't know the
file name; the macro will be run by someone else without macro experience

so
I need to set this up as foolproof as possible.
There are three things wrong with the following code:
1. the "If temp = 2" statement doesn't work; I am assuming because this

is
an input box and I haven't been able to find any help on code for this
2. the applications display alerts = false doesn't work. I don't want
there to be anymore dialogue just close down excel.
3. and three I want the user to be abel to open the excel workbook if it
is not already available.

Thanks,
Nicole

temp = InputBox("What is the name of the PRISM data Excel Workbook you

want
me to format for the M101 analysis?")
If temp = 2 Then Application.Quit
If temp = "" Then
MsgBox ("You did not enter a name. Please try again.")
temp = InputBox("What is the name the workbook you want me to format for

the
M101 analysis?")
If temp = "" Then
MsgBox ("Excel will now close. Have a good day.")
Application.DisplayAlerts = False
Application.Quit
End If
End If