View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JUAN JUAN is offline
external usenet poster
 
Posts: 39
Default Userform Can't seem to work right

Hello Chris,
its still doing the same. I do go to the Preview, but the
userform still shows and it get stuck. I can't do
anything. Can't evern close it manually or can't even use
excel. So I have to terminate.
Not sure why is doing it. When I select the other option
to save, I do get it to work fine. Doesn't get stuck. So
not sure why when I want to preview and stay here it get
stuck.

Any other advise?

Thanks,

juan
-----Original Message-----
try this:
Private Sub CommandButton1_Click()
If OptionButton1.Value = True Then
Sheets("ZSDQT002LATEST").PrintPreview
Unload Me
exit sub
ElseIf OptionButton2.Value = True Then
Application.GetSaveAsFilename
End If

End Sub


----- juan wrote: -----

Hello,
have userform with two Option buttons and two

command
buttons one for OK and Cancel.
Here's the code for the OK button:
Private Sub CommandButton1_Click()

' Dim MyButtons As Object

If OptionButton1.Value = True Then
Sheets("ZSDQT002LATEST").PrintPreview
UserForm1.Hide
ElseIf OptionButton2.Value = True Then
Application.GetSaveAsFilename
End If
End Sub
When I select the Print Preview option and click OK

it
goes to Print Preview, but the Userform doesn't

close and
can't close it and excel gets stuck. So I have to

End
program. Does anyone have idea why this is

happening.
Thanks,
Juan

.