Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MsgBox - newbie question

Status
Not open for further replies.

Edmee

IS-IT--Management
Dec 4, 2000
115
AU
This is probably very simple but here goes.

I have created a macro button in Word97 that changes the template when pressed. I would like a msgbox to pop up after pressing the button that explains what action this button will take and if the user would like to continue yes/no. If yes is pressed the macro runs, if no is pressed it doesn't. I have the following code:

Sub SlowFix()
With ActiveDocument
slow = MsgBox("Would you like to update your template?", 4)
If slow = 6 Then
.UpdateStylesOnOpen = False
.AttachedTemplate = "c:\program files\microsoft office\templates\normal.dot"
Else
End With
ActiveDocument.Save
End Sub

The first part (ie. if slow = 6 then) should work. However I'm not sure what to put after Else to have the code not run the macro.
Any help/suggestions very much appreciated.

Edmee
 
If you are not going to do anything ELSE, leave it out BUT you are missing the END IF.
Code:
Sub SlowFix()
    With ActiveDocument
            slow = MsgBox("Would you like to update your template?", 4)
            If slow = 6 Then
                .UpdateStylesOnOpen = False
                .AttachedTemplate = "c:\program files\microsoft office\templates\normal.dot"
            End If
    End With
    ActiveDocument.Save
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top