1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
| T1 = Sheet3.Cells(1, 1) & "_"
T2 = Sheet3.Cells(2, 1) & "_"
T3 = Sheet3.Cells(3, 1) & "\"
C1 = Sheet3.Cells(4, 1) & "\"
New_project = C1 & T1 & T2 & T3
Dim appword As Object
Set appword = New Word.Application
Application.DisplayAlerts = True
appword.ShowMe
appword.Visible = True
appword.Documents.Open Filename:="D:\My Documents\structure\Label\big and small label.doc"
If CheckBox1 Or CheckBox2 Or CheckBox3 Or CheckBox4 Then
ActiveDocument.Bookmarks("Project_Number1").Range.Text = Sheet3.Cells(1, 1)
ActiveDocument.Bookmarks("Customer_Name1").Range.Text = Sheet3.Cells(2, 1)
ActiveDocument.Bookmarks("Project_Name1").Range.Text = Sheet3.Cells(3, 1)
End If
If CheckBox5 Or CheckBox6 Or CheckBox7 Or CheckBox8 Then
ActiveDocument.Bookmarks("Project_Number2").Range.Text = Sheet3.Cells(1, 1)
ActiveDocument.Bookmarks("Customer_Name2").Range.Text = Sheet3.Cells(2, 1)
ActiveDocument.Bookmarks("Project_Name2").Range.Text = Sheet3.Cells(3, 1)
End If
If CheckBox9 Or CheckBox10 Or CheckBox11 Or CheckBox12 Then
ActiveDocument.Bookmarks("Project_Number3").Range.Text = Sheet3.Cells(1, 1)
ActiveDocument.Bookmarks("Customer_Name3").Range.Text = Sheet3.Cells(2, 1)
ActiveDocument.Bookmarks("Project_Name3").Range.Text = Sheet3.Cells(3, 1)
End If
If CheckBox13 Or CheckBox14 Or CheckBox15 Or CheckBox16 Then
ActiveDocument.Bookmarks("Project_Number4").Range.Text = Sheet3.Cells(1, 1)
ActiveDocument.Bookmarks("Customer_Name4").Range.Text = Sheet3.Cells(2, 1)
ActiveDocument.Bookmarks("Project_Name4").Range.Text = Sheet3.Cells(3, 1)
End If
If CheckBox17 Or CheckBox18 Or CheckBox19 Or CheckBox20 Then
ActiveDocument.Bookmarks("Project_Number5").Range.Text = Sheet3.Cells(1, 1)
ActiveDocument.Bookmarks("Customer_Name5").Range.Text = Sheet3.Cells(2, 1)
ActiveDocument.Bookmarks("Project_Name5").Range.Text = Sheet3.Cells(3, 1)
End If
If CheckBox21 Or CheckBox22 Or CheckBox23 Or CheckBox24 Then
ActiveDocument.Bookmarks("Project_Number6").Range.Text = Sheet3.Cells(1, 1)
ActiveDocument.Bookmarks("Customer_Name6").Range.Text = Sheet3.Cells(2, 1)
ActiveDocument.Bookmarks("Project_Name6").Range.Text = Sheet3.Cells(3, 1)
End If
If CheckBox25 Or CheckBox26 Or CheckBox27 Or CheckBox28 Then
ActiveDocument.Bookmarks("Project_Number7").Range.Text = Sheet3.Cells(1, 1)
ActiveDocument.Bookmarks("Customer_Name7").Range.Text = Sheet3.Cells(2, 1)
ActiveDocument.Bookmarks("Project_Name7").Range.Text = Sheet3.Cells(3, 1)
End If
If CheckBox29 Or CheckBox30 Or CheckBox31 Or CheckBox32 Then
ActiveDocument.Bookmarks("Project_Number8").Range.Text = Sheet3.Cells(1, 1)
ActiveDocument.Bookmarks("Customer_Name8").Range.Text = Sheet3.Cells(2, 1)
ActiveDocument.Bookmarks("Project_Name8").Range.Text = Sheet3.Cells(3, 1)
End If
If CheckBox33 Or CheckBox34 Or CheckBox35 Or CheckBox36 Then
ActiveDocument.Bookmarks("Project_Number9").Range.Text = Sheet3.Cells(1, 1)
ActiveDocument.Bookmarks("Customer_Name9").Range.Text = Sheet3.Cells(2, 1)
ActiveDocument.Bookmarks("Project_Name9").Range.Text = Sheet3.Cells(3, 1)
End If
If CheckBox37 Or CheckBox38 Or CheckBox39 Or CheckBox40 Then
ActiveDocument.Bookmarks("Project_Number10").Range.Text = Sheet3.Cells(1, 1)
ActiveDocument.Bookmarks("Customer_Name10").Range.Text = Sheet3.Cells(2, 1)
ActiveDocument.Bookmarks("Project_Name10").Range.Text = Sheet3.Cells(3, 1)
End If
If CheckBox41 Or CheckBox42 Or CheckBox43 Or CheckBox44 Then
ActiveDocument.Bookmarks("Project_Number11").Range.Text = Sheet3.Cells(1, 1)
ActiveDocument.Bookmarks("Customer_Name11").Range.Text = Sheet3.Cells(2, 1)
ActiveDocument.Bookmarks("Project_Name11").Range.Text = Sheet3.Cells(3, 1)
End If
If CheckBox1 Then _
ActiveDocument.Bookmarks("Department1s").Range.Text = "Sales"
If CheckBox2 Then _
ActiveDocument.Bookmarks("Department1pm").Range.Text = "Project Management"
If CheckBox3 Then _
ActiveDocument.Bookmarks("Department1e").Range.Text = "Engineering"
If CheckBox4 Then _
ActiveDocument.Bookmarks("Department1q").Range.Text = "Quality"
If CheckBox5 Then _
ActiveDocument.Bookmarks("Department2s").Range.Text = "Sales"
If CheckBox6 Then _
ActiveDocument.Bookmarks("Department2pm").Range.Text = "Project Management"
If CheckBox7 Then _
ActiveDocument.Bookmarks("Department2e").Range.Text = "Engineering"
If CheckBox8 Then _
ActiveDocument.Bookmarks("Department2q").Range.Text = "Quality"
If CheckBox9 Then _
ActiveDocument.Bookmarks("Department3s").Range.Text = "Sales"
If CheckBox10 Then _
ActiveDocument.Bookmarks("Department3pm").Range.Text = "Project Management"
If CheckBox11 Then _
ActiveDocument.Bookmarks("Department3e").Range.Text = "Engineering"
If CheckBox12 Then _
ActiveDocument.Bookmarks("Department3q").Range.Text = "Quality"
If CheckBox13 Then _
ActiveDocument.Bookmarks("Department4s").Range.Text = "Sales"
If CheckBox14 Then _
ActiveDocument.Bookmarks("Department4pm").Range.Text = "Project Management"
If CheckBox15 Then _
ActiveDocument.Bookmarks("Department4e").Range.Text = "Engineering"
If CheckBox16 Then _
ActiveDocument.Bookmarks("Department4q").Range.Text = "Quality"
If CheckBox17 Then _
ActiveDocument.Bookmarks("Department5s").Range.Text = "Sales"
If CheckBox18 Then _
ActiveDocument.Bookmarks("Department5pm").Range.Text = "Project Management"
If CheckBox19 Then _
ActiveDocument.Bookmarks("Department5e").Range.Text = "Engineering"
If CheckBox20 Then _
ActiveDocument.Bookmarks("Department5q").Range.Text = "Quality"
If CheckBox21 Then _
ActiveDocument.Bookmarks("Department6s").Range.Text = "Sales"
If CheckBox22 Then _
ActiveDocument.Bookmarks("Department6pm").Range.Text = "Project Management"
If CheckBox23 Then _
ActiveDocument.Bookmarks("Department6e").Range.Text = "Engineering"
If CheckBox24 Then _
ActiveDocument.Bookmarks("Department6q").Range.Text = "Quality"
If CheckBox25 Then _
ActiveDocument.Bookmarks("Department7s").Range.Text = "Sales"
If CheckBox26 Then _
ActiveDocument.Bookmarks("Department7pm").Range.Text = "Project Management"
If CheckBox27 Then _
ActiveDocument.Bookmarks("Department7e").Range.Text = "Engineering"
If CheckBox28 Then _
ActiveDocument.Bookmarks("Department7q").Range.Text = "Quality"
If CheckBox29 Then _
ActiveDocument.Bookmarks("Department8s").Range.Text = "Sales"
If CheckBox30 Then _
ActiveDocument.Bookmarks("Department8pm").Range.Text = "Project Management"
If CheckBox31 Then _
ActiveDocument.Bookmarks("Department8e").Range.Text = "Engineering"
If CheckBox32 Then _
ActiveDocument.Bookmarks("Department8q").Range.Text = "Quality"
If CheckBox33 Then _
ActiveDocument.Bookmarks("Department9s").Range.Text = "Sales"
If CheckBox34 Then _
ActiveDocument.Bookmarks("Department9pm").Range.Text = "Project Management"
If CheckBox35 Then _
ActiveDocument.Bookmarks("Department9e").Range.Text = "Engineering"
If CheckBox36 Then _
ActiveDocument.Bookmarks("Department9q").Range.Text = "Quality"
If CheckBox37 Then _
ActiveDocument.Bookmarks("Department10s").Range.Text = "Sales"
If CheckBox38 Then _
ActiveDocument.Bookmarks("Department10pm").Range.Text = "Project Management"
If CheckBox39 Then _
ActiveDocument.Bookmarks("Department10e").Range.Text = "Engineering"
If CheckBox40 Then _
ActiveDocument.Bookmarks("Department10q").Range.Text = "Quality"
If CheckBox41 Then _
ActiveDocument.Bookmarks("Department11s").Range.Text = "Sales"
If CheckBox42 Then _
ActiveDocument.Bookmarks("Department11pm").Range.Text = "Project Management"
If CheckBox43 Then _
ActiveDocument.Bookmarks("Department11e").Range.Text = "Engineering"
If CheckBox44 Then _
ActiveDocument.Bookmarks("Department11q").Range.Text = "Quality"
MsgBox "D:\My Documents\" & New_project
msg = "Do you have finished to create label?"
ans = MsgBox(msg, vbYesNo)
If ans = vbYes Then
appword.ChangeFileOpenDirectory "D:\My Documents\" & New_project
ActiveDocument.SaveAs Filename:="Big And Small Label.doc"
appword.Quit
Unload UserForm3
End If
If ans = vbNo Then
Unload UserForm3
appword.ChangeFileOpenDirectory "D:\My Documents\" & New_project
ActiveDocument.SaveAs Filename:="Big And Small Label1.doc"
appword.Quit
Unload UserForm3
UserForm2.Show
End If
End Sub |
Partager