UserForm Question
Thanks much works like a charm
jer
-----Original Message-----
Try this on a new workbook, then apply it to your
existing when you are
satisfied that it works for you:
Create a new Userform with just one CmdButton
Dbl click this button
Insert this code in the button_click event
Me.Hide
ThisWorkbook.Close True
Actually the first line may be optional.
The second line is mainly what you asked for: How to
close a wbk from within
a userform. The TRUE part will SAVE the file before
closing it
Hope this helps
"jer" wrote:
Thanks much. OK, in the excel workbook I have a macro
that shows the form and in this macro I have unloaded
the
form. However, I have set up the form so that when the
user inputs his choices he clicks a submit button,
Private
sub, but I have not included unload form as part of
the
macro for this button. Additionally I have tried to
create a separate macro to save and close the file and
call it from the submit buttion. This too does not work
Can you explain a little more about unloading or offer
other suggestion(s)
thanks again
jer
-----Original Message-----
Just a guess but have you unloaded the userform?
And is the Spelling and CASE of the wsh name the same:
"Example.xls" vs "example.xls"
"jer" wrote:
Is it possible to save and close a file via a
userform. I
have created a form that I want to survey my
internal
customers. The file will reside in a folder to
which
we
all have access. I was hoping that when the
respondent
clicks on the submit button their choice will update
another worksheet (hidden) and close the file
automatically. Everything else seems to be working
fine
exept that I cannot get the file to close, any
suggestions?
the following is the last line of code attached to
the
Submit button
Private Sub cmdSubmit_Click()
....
Workbooks("example.xls").Close savechanges:=True
end sub
where example.xls is the file that contains the
userform
thanks in advance for any help suggestions
jer
.
.
|