PDA

View Full Version : Macro Save Options



oricon38
09-07-2017, 06:30 PM
I have a macro that saves an active document but I have to comment out either the first line (pdf), the second (docx) or the third (doc) depending on which scenario I'm using.

Sometimes it is faster to just click save as to change the file type.

However, I was wondering if there was an option to get a Msgbox with three buttons (I seem to only get the Yes No option) and have each button correlate to which type of file it will be?

Many thanks in advance!

Logit
09-07-2017, 08:46 PM
.
The simplest and safest method is to create a routine User Form that looks like a MsgBox.

Here is the macro code for the Routine Module :



Sub Button1_Click()
UserForm1.Show
End Sub




Sub Macro1()
Range("A1").Value = 1
End Sub




Sub Macro2()
Range("A1").Value = 2
End Sub



Here is the code for the User Form:



Private Sub CommandButton1_Click()
Call Macro1
Unload Me
End Sub


Private Sub CommandButton2_Click()
Call Macro2
Unload Me
End Sub




Note that the User Form code presently has two buttons. You can add a third, with its own caption and call to a third macro. Each of your macros will be assigned to open either the PDF, or the DOCX or the DOC.