View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Restore Userform

2. The close method for the Workbooks object takes no arguments

You could do

for each bk in workbooks
if bk.name < thisworkbook.name then
bk.close SaveChanges:=False
end if
Next
Application.Quit

1. As for reshowing the userform, it is unclear what you mean by closing the
document. I the user closes the workbook that contains the form, then you
would have to reopen the workbook and issue the command to display the form.

--
Regards,
Tom Ogilvy


"Clarissa" wrote:

Hi Everyone, Thanks in advance for any help! I have two issues,

1. I'm using a userform where the user will "view" a report in excel. When
the document is opened, the userform unloads. The user views the document
and then closes it. How can I then have the userform back on the screen
again?

2. Also, I have an Exit button which will exit the macro/workbook - exiting
the macro and closing the file. The error I get is: compile error - wrong
number of arguments or invalid property.

Here's that code:
Private Sub CommandButton3_Click()
Workbooks.Close savechanges:=False
End Sub