C
constance
Hi everybody I have a question for you
i used inputbox in order to place the fields where i want in my
document, the problem is that input boxes are modal windows and you
can't go back to the open document to to do a copy paste in the text
box of the information you want
Is there a solution to have these input boxes non modal so I can swith
from the document to those boxes or tou have another solution
another way to proceed if there is no solution to my problem is to know
if i can do tests on values typed in my word document when i do a file
save as in the word menu
is it possible ? can you gimme the syntax
thanks for all the help you can give me
here is my macro you can execute with word
Sub FormatArretJuricaf()
Dim REP As Variant
Dim NumArret$
Dim DateArret As Date
Dim DateArretNomFichier
Dim Response
Static Formation$, Section$
Selection.HomeKey Unit:=wdStory
ActiveWindow.ActivePane.View.ShowAll = Not
ActiveWindow.ActivePane.View. _
ShowAll
Selection.Font.Size = 12
Selection.Font.Italic = wdToggle
Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify
Selection.TypeParagraph
Selection.TypeParagraph
Selection.InsertBreak Type:=wdSectionBreakContinuous
Selection.Font.Color = wdColorRed
Selection.TypeText Text:="Formation :"
Selection.TypeParagraph
Selection.InsertBreak Type:=wdSectionBreakContinuous
ActiveDocument.Sections(1).ProtectedForForms = True
ActiveDocument.Sections(2).ProtectedForForms = True
ActiveDocument.Sections(3).ProtectedForForms = False
ActiveDocument.Protect Password:="", NoReset:=False, Type:= _
wdAllowOnlyFormFields
Formation$ = InputBox("Type the formation", "FORMATION",
Formation$)
If Formation$ = "" Then
Response = MsgBox("Error", vbOKOnly, "ERREUR")
Exit Sub
End If
Formation$ = Formation$
Selection.Font.Color = wdColorAutomatic
Selection.TypeText Text:=Formation$
Selection.TypeParagraph
ActiveDocument.Sections(1).ProtectedForForms = True
ActiveDocument.Sections(2).ProtectedForForms = True
ActiveDocument.Sections(3).ProtectedForForms = False
Selection.TypeParagraph
Selection.InsertBreak Type:=wdSectionBreakContinuous
Selection.InsertBreak Type:=wdSectionBreakContinuous
Selection.TypeText Text:="Section :"
Selection.TypeParagraph
Selection.InsertBreak Type:=wdSectionBreakContinuous
ActiveDocument.Sections(4).ProtectedForForms = True
ActiveDocument.Sections(5).ProtectedForForms = True
ActiveDocument.Sections(6).ProtectedForForms = False
' Saisie de la Section
'Section$ = InputBox("Type the section", "SECTION", Section$)
If Section$ = "" Then
Response = MsgBox("Error", vbOKOnly, "ERREUR")
Exit Sub
End If
Selection.Font.Color = wdColorAutomatic
Selection.TypeText Text:=Section$
Selection.TypeParagraph
Selection.InsertBreak Type:=wdSectionBreakContinuous
Selection.InsertBreak Type:=wdSectionBreakContinuous
Selection.Font.Color = wdColorRed
Selection.TypeText Text:="Number :"
Selection.TypeParagraph
Selection.InsertBreak Type:=wdSectionBreakContinuous
ActiveDocument.Sections(7).ProtectedForForms = True
ActiveDocument.Sections(8).ProtectedForForms = True
ActiveDocument.Sections(9).ProtectedForForms = False
NumArret$ = InputBox("Type the number", "Number", "Number")
If NumArret$ = "" Then
Response = MsgBox("Error", vbOKOnly, "ERREUR")
Exit Sub
End If
Selection.Font.Color = wdColorAutomatic
Selection.TypeText Text:=NumArret$
Selection.TypeParagraph
Selection.InsertBreak Type:=wdSectionBreakContinuous
Selection.InsertBreak Type:=wdSectionBreakContinuous
Selection.TypeText Text:="Date(format jj/mm/aaaa) :"
Selection.TypeParagraph
Selection.InsertBreak Type:=wdSectionBreakContinuous
ActiveDocument.Sections(10).ProtectedForForms = True
ActiveDocument.Sections(11).ProtectedForForms = True
ActiveDocument.Sections(12).ProtectedForForms = False
'Saisie de la Date de l'arrêt
Do
REP = InputBox("Type the date with the format(dd/yy/mmmm)",
"DATE", Date)
If REP = "" Then
Response = MsgBox("Erreur", vbOKOnly, "ERREUR")
Exit Sub
Else
If IsDate(REP) Then
DateArret = Format$(REP, "dd/mm/yyyy")
DateArretNomFichier = FormatDateTime(Date,
vbGeneralDate)
Exit Do
Else
Beep
Response = MsgBox("incorrect format dd/yy/mmmm.",
vbOKOnly, "ERREUR")
End If
End If
Loop
Selection.Font.Color = wdColorAutomatic
Selection.TypeText Text:=DateArret
Selection.TypeParagraph
End sub
i used inputbox in order to place the fields where i want in my
document, the problem is that input boxes are modal windows and you
can't go back to the open document to to do a copy paste in the text
box of the information you want
Is there a solution to have these input boxes non modal so I can swith
from the document to those boxes or tou have another solution
another way to proceed if there is no solution to my problem is to know
if i can do tests on values typed in my word document when i do a file
save as in the word menu
is it possible ? can you gimme the syntax
thanks for all the help you can give me
here is my macro you can execute with word
Sub FormatArretJuricaf()
Dim REP As Variant
Dim NumArret$
Dim DateArret As Date
Dim DateArretNomFichier
Dim Response
Static Formation$, Section$
Selection.HomeKey Unit:=wdStory
ActiveWindow.ActivePane.View.ShowAll = Not
ActiveWindow.ActivePane.View. _
ShowAll
Selection.Font.Size = 12
Selection.Font.Italic = wdToggle
Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify
Selection.TypeParagraph
Selection.TypeParagraph
Selection.InsertBreak Type:=wdSectionBreakContinuous
Selection.Font.Color = wdColorRed
Selection.TypeText Text:="Formation :"
Selection.TypeParagraph
Selection.InsertBreak Type:=wdSectionBreakContinuous
ActiveDocument.Sections(1).ProtectedForForms = True
ActiveDocument.Sections(2).ProtectedForForms = True
ActiveDocument.Sections(3).ProtectedForForms = False
ActiveDocument.Protect Password:="", NoReset:=False, Type:= _
wdAllowOnlyFormFields
Formation$ = InputBox("Type the formation", "FORMATION",
Formation$)
If Formation$ = "" Then
Response = MsgBox("Error", vbOKOnly, "ERREUR")
Exit Sub
End If
Formation$ = Formation$
Selection.Font.Color = wdColorAutomatic
Selection.TypeText Text:=Formation$
Selection.TypeParagraph
ActiveDocument.Sections(1).ProtectedForForms = True
ActiveDocument.Sections(2).ProtectedForForms = True
ActiveDocument.Sections(3).ProtectedForForms = False
Selection.TypeParagraph
Selection.InsertBreak Type:=wdSectionBreakContinuous
Selection.InsertBreak Type:=wdSectionBreakContinuous
Selection.TypeText Text:="Section :"
Selection.TypeParagraph
Selection.InsertBreak Type:=wdSectionBreakContinuous
ActiveDocument.Sections(4).ProtectedForForms = True
ActiveDocument.Sections(5).ProtectedForForms = True
ActiveDocument.Sections(6).ProtectedForForms = False
' Saisie de la Section
'Section$ = InputBox("Type the section", "SECTION", Section$)
If Section$ = "" Then
Response = MsgBox("Error", vbOKOnly, "ERREUR")
Exit Sub
End If
Selection.Font.Color = wdColorAutomatic
Selection.TypeText Text:=Section$
Selection.TypeParagraph
Selection.InsertBreak Type:=wdSectionBreakContinuous
Selection.InsertBreak Type:=wdSectionBreakContinuous
Selection.Font.Color = wdColorRed
Selection.TypeText Text:="Number :"
Selection.TypeParagraph
Selection.InsertBreak Type:=wdSectionBreakContinuous
ActiveDocument.Sections(7).ProtectedForForms = True
ActiveDocument.Sections(8).ProtectedForForms = True
ActiveDocument.Sections(9).ProtectedForForms = False
NumArret$ = InputBox("Type the number", "Number", "Number")
If NumArret$ = "" Then
Response = MsgBox("Error", vbOKOnly, "ERREUR")
Exit Sub
End If
Selection.Font.Color = wdColorAutomatic
Selection.TypeText Text:=NumArret$
Selection.TypeParagraph
Selection.InsertBreak Type:=wdSectionBreakContinuous
Selection.InsertBreak Type:=wdSectionBreakContinuous
Selection.TypeText Text:="Date(format jj/mm/aaaa) :"
Selection.TypeParagraph
Selection.InsertBreak Type:=wdSectionBreakContinuous
ActiveDocument.Sections(10).ProtectedForForms = True
ActiveDocument.Sections(11).ProtectedForForms = True
ActiveDocument.Sections(12).ProtectedForForms = False
'Saisie de la Date de l'arrêt
Do
REP = InputBox("Type the date with the format(dd/yy/mmmm)",
"DATE", Date)
If REP = "" Then
Response = MsgBox("Erreur", vbOKOnly, "ERREUR")
Exit Sub
Else
If IsDate(REP) Then
DateArret = Format$(REP, "dd/mm/yyyy")
DateArretNomFichier = FormatDateTime(Date,
vbGeneralDate)
Exit Do
Else
Beep
Response = MsgBox("incorrect format dd/yy/mmmm.",
vbOKOnly, "ERREUR")
End If
End If
Loop
Selection.Font.Color = wdColorAutomatic
Selection.TypeText Text:=DateArret
Selection.TypeParagraph
End sub