Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
jer jer is offline
external usenet poster
 
Posts: 8
Default UserForm Question

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default UserForm Question

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
jer jer is offline
external usenet poster
 
Posts: 8
Default UserForm Question

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


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default UserForm Question

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


.


  #5   Report Post  
Posted to microsoft.public.excel.programming
jer jer is offline
external usenet poster
 
Posts: 8
Default 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


.


.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform question Brad Excel Discussion (Misc queries) 4 March 15th 10 04:43 PM
Userform question Anthony Excel Worksheet Functions 4 June 27th 08 04:26 PM
Userform Question Ray Batig Excel Programming 0 September 20th 04 12:37 AM
Userform question Oreg[_8_] Excel Programming 1 May 27th 04 02:46 AM
userform question Rob Bovey Excel Programming 0 August 25th 03 11:43 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"