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 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742
|
Option Explicit
Public NextReadTime As String
Public UMSInfo As Object
Public Main As AMS.Mainframe
Public pw As AMS.ProbeWindow
Public curr_prot As DataStore.Protocol
Public sr As Boolean
Public CurMeas As Object
Dim NewMeas As Object
Public Raum As Worksheet
Public page%, btn%, btn_m%, btn_r%, m
Public Start_Flag As Boolean
Public Livemappe As Object, Liveblatt As Object, Livezelle As Object
Public DevName$, RoomName$
Public forma$, formb$
Dim prot$, user$, key$, comment$, operator$, pathtofiles$, filename$, oldfilename_short$
Dim Ans As Variant
Dim mins() As Double
Dim min As Double
Dim SourcesA() As Source
Dim SourceA As Source
Dim NuclideA As String
Dim SourcesB() As Source
Dim SourceB As Source
Dim NuclideB As String
Public params_readed As Boolean
Public Pruef As Boolean
Public measrun As Boolean
Public Color
Public ProbeNames(9) As String
Public ProbeNumbers(9) As Double
Sub Start_AMS()
Dim i%, StartLine%, n%
Dim currcell$
Dim m As Integer
Dim dname$, vname$
Dim ProbeNames(9) As String
Dim ProbeNumbers(9) As Double
Dim curcell As Range
Call Blatt_aktiv
If IsEmpty(Raum.Range("E59").Value) Then
prot = ""
Else
prot = Raum.Range("E59").Value
End If
Start_Flag = True
On Error Resume Next
Set Main = GetObject(, "MMLB790.Main")
If Err.Number = 429 Then
Ans = MsgBox("Bitte starten Sie Berthold AMS!", vbCritical)
Exit Sub
End If
If Err.Number <> 0 Then
MsgBox "Error " & Err & ": " & Error(Err.Number)
Exit Sub
End If
Select Case btn_m
Case 1
m = 0
Case 2
m = 1
Case 3
m = 2
End Select
If Raum.Range("I15").Value = "" Then
'Ans = MsgBox("Bitte geben Sie einen Ort zu diesem Wischtest an!", vbCritical)
Ans = MsgBox("You did not enter a location for the wipe test!")
Raum.Range("I15").Select
Exit Sub
End If
DevName = CStr(Raum.Range("C7").Value)
If Main.ProbeWindows.Count = 0 Then
'Ans = MsgBox("Bitte definieren Sie ein Detektorsystem in Berthold AMS!", vbCritical)
Ans = MsgBox("Please define at least one detector system in Berthold AMS!", vbCritical)
Exit Sub
End If
Dim pwtrue As Boolean
Dim prottrue As Boolean
Dim items As Integer
Dim currprot As String
pwtrue = False
prottrue = False
For items = 0 To Main.ProbeWindows.Count - 1
If Main.ProbeWindows(items).Text = DevName Then
Set pw = Main.ProbeWindows.Item(items)
pwtrue = True
Exit For
End If
Next items
If pwtrue = False Then
'Ans = MsgBox("Es wurde kein übereinstimmendes Detektorsystem in Berthold AMS gefunden!", vbCritical)
Ans = MsgBox("You did not enter a correct detector name. Please check name and spelling!")
Raum.Range("C7").Select
Exit Sub
End If
measrun = pw.MeasRunning
If pw.SD.detector.Protocols.Count = 0 Then
'Ans = MsgBox("Bitte definieren Sie in Berthold AMS ein Benutzerprotocol für das Detektorsystem " & Chr(34) & DevName & Chr(34) & ".", vbCritical)
Ans = MsgBox("Please define at least one user protocol for detector system " & Chr(34) & DevName & Chr(34) & " in Berthold AMS", vbCritical)
Exit Sub
End If
If Main.SetupData.Securitylevel = DataStore.Securitylevel_None Or Main.SetupData.Securitylevel = DataStore.Securitylevel_UserLo Then ' is user login required?
user = ""
Else
user = Raum.Range("I59").Value
If user = "" Then
'Ans = MsgBox("Für diese Messung muss ein Benutzername eingegeben werden!", vbCritical)
Ans = MsgBox("A user name is required to start the measurement!", vbCritical)
Exit Sub
End If
Dim usertrue As Boolean
usertrue = False
If (Main.Users.Count = 0) Then 'no user defined
'Ans = MsgBox("Bitte definieren Sie einen Benutzer in Berthold AMS!", vbCritical)
Ans = MsgBox("Please define a user name in Berthold AMS!", vbCritical)
Exit Sub
End If
For items = 0 To Main.Users.Count - 1
If Main.Users(items).Name = user Then 'user existing??
If Main.Users(items).Probemeasure = False Then
'Ans = MsgBox("Der Benutzer " & Chr(34) & user & Chr(34) & " ist nicht berechtigt Probenmessungen durchzuführen!", vbCritical)
Ans = MsgBox("User " & Chr(34) & user & Chr(34) & " is not authorized to perform sample measurements!", vbCritical)
Exit Sub
End If
usertrue = True
Exit For
End If
Next items
If (usertrue = False) Then
'Ans = MsgBox("Bitte überprüfen Sie den Benutzernamen.", vbCritical)
Ans = MsgBox("Please check the spelling of the user name.", vbCritical)
Exit Sub
End If
If Main.CurrentUserName = "" Then 'no user logged in
'Ans = MsgBox("Bitte melden Sie den Benutzer in Berthold AMS an.", vbCritical)
Ans = MsgBox("Please login user in Berthold AMS", vbCritical)
Exit Sub
End If
If user <> Main.CurrentUserName Then 'different user logged in
'Ans = MsgBox("Excel user" & Chr(34) & user & Chr(34) & " entspricht nicht dem eingeloggten Benutzer " & Chr(34) & Main.CurrentUserName & Chr(34) & " in Berthold AMS!", vbCritical)
Ans = MsgBox("Excel user" & Chr(34) & user & Chr(34) & " does not correspond to current user " & Chr(34) & Main.CurrentUserName & Chr(34) & " in Berthold AMS!", vbCritical)
Exit Sub
End If
End If
If prot = "" Then
'Ans = MsgBox("Bitte geben Sie ein Protokoll an.", vbCritical)
Ans = MsgBox("Please enter a protocol name!", vbCritical)
Exit Sub
End If
For items = 0 To pw.SD.detector.Protocols.Count - 1
If pw.SD.detector.Protocols(items).Name = prot Then
Set curr_prot = pw.SD.detector.Protocols(items)
currprot = prot
prottrue = True
Exit For
End If
Next items
If prottrue = False Then
'Ans = MsgBox("Das Protokoll " & Chr(34) & prot & Chr(34) & " ist für das Detektorsystem " & Chr(34) & DevName & Chr(34) & " nicht definiert.", vbCritical)
Ans = MsgBox("The protocol " & Chr(34) & prot & Chr(34) & " does not exist for detector system " & Chr(34) & DevName & Chr(34) & ".", vbCritical)
Exit Sub
End If
If curr_prot.Systemmode <> 3 Then
'Ans = MsgBox ("Bitte wählen Sie im Protokoll unter Systemmodus den Modus " & Chr(34) & "Alpha/Beta" & Chr(34) & " aus.", vbCritical)
Ans = MsgBox("Please select Alpha/Beta as System Mode", vbCritical)
Exit Sub
End If
If curr_prot.UseWipearea = False Or curr_prot.WipeUnit <> "cm²" Then
'Ans = MsgBox("Bitte definieren Sie im Benutzerprotokoll eine Wischfläche und wählen Sie die Einheit cm² aus.", vbCritical)
Ans = MsgBox("Please select wipe area with unit cm² in the current user protocol!", vbCritical)
Exit Sub
End If
Dim d As Variant
currcell = "B" & 18 + m * 14
If Raum.Range(currcell).Value = "" Then
comment = Raum.Range("I15").Value
Else
comment = Raum.Range("I15").Value & " / " & Raum.Range(currcell).Value
End If
currcell = "I" & 18 + m * 14
filename = Raum.Range(currcell).Value
If (filename <> "") Then
If InStr(filename, ".sdt") Then
filename = Left(filename, Len(filename) - 4)
End If
Dim pos As Integer
If InStr(curr_prot.path, ":") Then
pathtofiles = curr_prot.path + "\"
Else
pathtofiles = Main.StartupPath & "\" & curr_prot.path & "\"
End If
Ans = LoopThroughFiles(pathtofiles, filename)
Do While Ans = vbNo
Dim s, s1, s2 As Variant
Dim endnum As Integer
s = filename
s2 = s
Do While IsNumeric(s) = False
s = Right(s, Len(s) - 1)
If s = "" Then Exit Do
Loop
If s = "" Then endnum = 0
If s <> "" Then endnum = CInt(s)
endnum = endnum + 1
s1 = CStr(endnum)
s2 = Left(s2, Len(s2) - Len(s))
filename = s2 & s1
Ans = LoopThroughFiles(pathtofiles, filename)
Loop
Else
pathtofiles = ""
End If
operator = Raum.Range("C63")
Raum.Unprotect
currcell = "I" & 18 + 14 * m
If (filename <> "") Then
Raum.Range(currcell).Value = filename + ".sdt"
Else
Raum.Range(currcell).Value = ""
End If
If pathtofiles = "" Then
Raum.Range("B60").Value = ""
Raum.Range("E60").Value = ""
Else
Raum.Range("B60").Value = "Dateipfad"
Raum.Range("E60").Value = pathtofiles
End If
Dim vrs() As String
Dim vrs_shrt As String
Dim element As Variant
vrs = Split(Main.ProductVersion, ".")
element = 0
Do While element < 3
If vrs(element) <> 0 Then
If element <> 0 Then
vrs_shrt = vrs_shrt & "." & vrs(element)
Else
vrs_shrt = vrs(element)
End If
End If
element = element + 1
Loop
If Main.Mainlight Then
vrs_shrt = vrs_shrt & " Light"
End If
Raum.Range("B16").Value = "Version " & vrs_shrt
Raum.Protect
items = 0
Dim currcell1$, currcell2$
currcell1 = "B" & 19 + m * 14
currcell2 = "B" & 28 + m * 14
For Each curcell In Raum.Range(currcell1, currcell2)
If curcell.Value = "" Then
Raum.Unprotect
Raum.Cells(curcell.Row, curcell.Column + 2) = ""
Raum.Protect
End If
ProbeNames(items) = curcell.Value
items = items + 1
Next curcell
items = 0
currcell1 = "D" & 19 + m * 14
currcell2 = "D" & 28 + m * 14
For Each curcell In Raum.Range(currcell1, currcell2)
ProbeNumbers(items) = curcell.Value
items = items + 1
Next curcell
ClearCells
'Entering protocol meas time in macro output
'Raum.Unprotect
'mins = curr_prot.TimeMin
'min = mins(0)
'currcell = "C" & 29 + m * 14
'Raum.Range(currcell).Value = Format(min * 60 / 86400, "hh:nn:ss")
'Raum.Protect
'Output of nuclides used for calibration
' Raum.Unprotect
' SourcesA = curr_prot.LastCalibA.GetSources
' SourcesB = curr_prot.LastCalibB.GetSources
' For i = 1 To 10
' Set SourceA = curr_prot.LastCalibA.GetSource(i - 1)
' Set SourceB = curr_prot.LastCalibB.GetSource(i - 1)
' NuclideA = SourceA.Nuclide.Name
' NuclideB = SourceB.Nuclide.Name
' currcell = "I" & i + 18 + m * 14
' Raum.Range(currcell).Value = "A: " & NuclideA & " / " & "B: " & NuclideB
' Next i
' Raum.Protect
LockCells
sr = pw.Start_Measurement(currprot, ProbeNames, ProbeNumbers, user, filename, comment, operator)
NextReadTime = NowPlus(2)
Application.OnTime EarliestTime:=NextReadTime, Procedure:="ReadAMS"
End Sub
'
' Start_ParamDlg Makro
'
'
Sub Start_ParamDlg()
If measrun = True Then
Ans = MsgBox("Berthold AMS is currently performing a measurement!", vbCritical)
Exit Sub
End If
Do While key <> "WKP"
ThisWorkbook.DialogSheets("KeyDlg").Show
If key = "" Then Exit Sub
Loop
If (key = "WKP") Then
ThisWorkbook.DialogSheets("ParamDlg").Show
'Else
' ThisWorkbook.DialogSheets("KeyDlg").Show
End If
End Sub
Sub KeyDlg_BeiAnzeigen()
key = ""
ActiveDialog.[key].Text = ""
End Sub
Sub BTN_KeyOK_BeiKlick()
key = ActiveDialog.[key].Text
End Sub
Sub BTN_KeyABBR_BeiKlick()
key = ""
End Sub
'
' DFR_PARAM_BeiAnzeigen Makro
'
'
Sub DFR_PARAM_BeiAnzeigen()
Call Blatt_aktiv
With ActiveDialog
.[BF_DEVNAME].Text = "" 'reset to avoid uppercase/lowercase issues
.[BF_DEVNAME].Text = Raum.Range("C7").Value
.[BF_HEADER].Text = ""
.[BF_HEADER].Text = Raum.Range("B10").Value
.[BF_ROOM].Text = ""
.[BF_ROOM].Text = Raum.Range("I15").Value
.[BF_USERNAME].Text = ""
.[BF_USERNAME].Text = Raum.Range("I59").Value
.[BF_USERPROT].Text = ""
.[BF_USERPROT].Text = Raum.Range("E59").Value 'prot
End With
End Sub
'
' BTN_PARAMOK_BeiKlick Makro
'
'
Sub BTN_PARAMOK_BeiKlick()
Dim x, slash
Dim sh As Shape
Raum.Unprotect
With ActiveDialog
Raum.Range("C7").Value = .[BF_DEVNAME].Text
Raum.Range("B10").Value = .[BF_HEADER].Text
Raum.Range("I15").Value = .[BF_ROOM].Text
Raum.Range("I59").Value = .[BF_USERNAME].Text
Raum.Range("E59").Value = .[BF_USERPROT].Text
Raum.Range("B16").Value = ""
Raum.Range("E60").Value = ""
Raum.Range("C62").Value = ""
For Each sh In Raum.Shapes
If sh.Name = "BTN_R1" Then BTN_R1_BeiKlick
If sh.Name = "BTN_R2" Then BTN_R2_BeiKlick
If sh.Name = "BTN_R3" Then BTN_R3_BeiKlick
Next
End With
Raum.Protect
End Sub
Function LoopThroughFiles(path As String, fname As String) As Double
Dim MyObj As Object, MySource As Object, file As Variant
Ans = vbYes
file = Dir(path)
Do While (file <> "")
If InStr(file, fname & ".sdt") > 0 Then
Ans = MsgBox("File name " & Chr(34) & fname & Chr(34) & " exists. Overwrite?", vbYesNo)
Exit Do
'Exit Sub
End If
file = Dir
Loop
LoopThroughFiles = Ans
End Function
'
' BTN_PARAMCANCEL_BeiKlick Makro
'
'
Sub BTN_PARAMCANCEL_BeiKlick()
End Sub
Sub Start_MeasDlg()
ThisWorkbook.DialogSheets("MeasDlg").Show
End Sub
'
' DFR_MEAS_BeiAnzeigen Makro
'
'
Sub DFR_MEAS_BeiAnzeigen()
' Select Case btn_m
' Case 1
' With ActiveDialog
' .[BF_MEASLOC].Text = Raum.Range("B18").Value
' .[BF_MEASPLACE1].Text = Raum.Range("B19").Value
' .[BF_MEASPLACE2].Text = Raum.Range("B20").Value
' .[BF_MEASPLACE3].Text = Raum.Range("B21").Value
' .[BF_MEASPLACE4].Text = Raum.Range("B22").Value
' .[BF_MEASPLACE5].Text = Raum.Range("B23").Value
' .[BF_MEASPLACE6].Text = Raum.Range("B24").Value
' .[BF_MEASPLACE7].Text = Raum.Range("B25").Value
' .[BF_MEASPLACE8].Text = Raum.Range("B26").Value
' .[BF_MEASPLACE9].Text = Raum.Range("B27").Value
' .[BF_MEASPLACE10].Text = Raum.Range("B28").Value
' End With
' Case 2
' With ActiveDialog
' .[BF_MEASLOC].Text = Raum.Range("B29").Value
' .[BF_MEASPLACE1].Text = Raum.Range("B30").Value
' .[BF_MEASPLACE2].Text = Raum.Range("B31").Value
' .[BF_MEASPLACE3].Text = Raum.Range("B32").Value
' .[BF_MEASPLACE4].Text = Raum.Range("B33").Value
' .[BF_MEASPLACE5].Text = Raum.Range("B34").Value
' .[BF_MEASPLACE6].Text = Raum.Range("B35").Value
' .[BF_MEASPLACE7].Text = Raum.Range("B36").Value
' .[BF_MEASPLACE8].Text = Raum.Range("B37").Value
' .[BF_MEASPLACE9].Text = Raum.Range("B38").Value
' .[BF_MEASPLACE10].Text = Raum.Range("B39").Value
' End With
' Case 3
' With ActiveDialog
' .[BF_MEASLOC].Text = Raum.Range("B40").Value
' .[BF_MEASPLACE1].Text = Raum.Range("B41").Value
' .[BF_MEASPLACE2].Text = Raum.Range("B42").Value
' .[BF_MEASPLACE3].Text = Raum.Range("B43").Value
' .[BF_MEASPLACE4].Text = Raum.Range("B44").Value
' .[BF_MEASPLACE5].Text = Raum.Range("B45").Value
' .[BF_MEASPLACE6].Text = Raum.Range("B46").Value
' .[BF_MEASPLACE7].Text = Raum.Range("B47").Value
' .[BF_MEASPLACE8].Text = Raum.Range("B48").Value
' .[BF_MEASPLACE9].Text = Raum.Range("B49").Value
' .[BF_MEASPLACE10].Text = Raum.Range("B50").Value
' End With
' End Select
End Sub
'
' BTN_MEASOK_BeiKlick Makro
'
'
Sub BTN_MEASOK_BeiKlick()
Raum.Unprotect
' Select Case btn_m
' Case 1
' With ActiveDialog
' Raum.Range("B18").Value = .[BF_MEASLOC].Text
' Raum.Range("B19").Value = .[BF_MEASPLACE1].Text
' Raum.Range("B20").Value = .[BF_MEASPLACE2].Text
' Raum.Range("B21").Value = .[BF_MEASPLACE3].Text
' Raum.Range("B22").Value = .[BF_MEASPLACE4].Text
' Raum.Range("B23").Value = .[BF_MEASPLACE5].Text
' Raum.Range("B24").Value = .[BF_MEASPLACE6].Text
' Raum.Range("B25").Value = .[BF_MEASPLACE7].Text
' Raum.Range("B26").Value = .[BF_MEASPLACE8].Text
' Raum.Range("B27").Value = .[BF_MEASPLACE9].Text
' Raum.Range("B28").Value = .[BF_MEASPLACE10].Text
' End With
' Case 2
' With ActiveDialog
' Raum.Range("B29").Value = .[BF_MEASLOC].Text
' Raum.Range("B30").Value = .[BF_MEASPLACE1].Text
' Raum.Range("B31").Value = .[BF_MEASPLACE2].Text
' Raum.Range("B32").Value = .[BF_MEASPLACE3].Text
' Raum.Range("B33").Value = .[BF_MEASPLACE4].Text
' Raum.Range("B34").Value = .[BF_MEASPLACE5].Text
' Raum.Range("B35").Value = .[BF_MEASPLACE6].Text
' Raum.Range("B36").Value = .[BF_MEASPLACE7].Text
' Raum.Range("B37").Value = .[BF_MEASPLACE8].Text
' Raum.Range("B38").Value = .[BF_MEASPLACE9].Text
' Raum.Range("B39").Value = .[BF_MEASPLACE10].Text
' End With
' Case 3
' With ActiveDialog
' Raum.Range("B40").Value = .[BF_MEASLOC].Text
' Raum.Range("B41").Value = .[BF_MEASPLACE1].Text
' Raum.Range("B42").Value = .[BF_MEASPLACE2].Text
' Raum.Range("B43").Value = .[BF_MEASPLACE3].Text
' Raum.Range("B44").Value = .[BF_MEASPLACE4].Text
' Raum.Range("B45").Value = .[BF_MEASPLACE5].Text
' Raum.Range("B46").Value = .[BF_MEASPLACE6].Text
' Raum.Range("B47").Value = .[BF_MEASPLACE7].Text
' Raum.Range("B48").Value = .[BF_MEASPLACE8].Text
' Raum.Range("B49").Value = .[BF_MEASPLACE9].Text
' Raum.Range("B50").Value = .[BF_MEASPLACE10].Text
' End With
' End Select
Raum.Protect
End Sub
Sub BTN_1_Allgemein_BeiKlicken()
End Sub
'
' BTN_1_BeiKlick Makro
'
'
Sub BTN_1_BeiKlick()
btn = 1
'Start_AMS
End Sub
'
' BTN_2_BeiKlick Makro
'
'
Sub BTN_2_BeiKlick()
btn = 2
'Start_AMS
End Sub
'
' BTN_3_BeiKlick Makro
'
'
Sub BTN_3_BeiKlick()
btn = 3
'Start_AMS
End Sub
'
' BTN_M1_BeiKlick Makro
'
'
Sub BTN_M1_BeiKlick()
If (measrun = False) Then
btn_m = 1
btn_r = 1
' ClearCells
' LockCells
Start_AMS
Else
Ans = MsgBox("Berthold AMS is currently performing a measurement!", vbCritical)
End If
End Sub
'
' BTN_M2_BeiKlick Makro
'
'
Sub BTN_M2_BeiKlick()
If (measrun = False) Then
btn_m = 2
btn_r = 2
' ClearCells
' LockCells
Start_AMS
Else
Ans = MsgBox("Berthold AMS is currently performing a measurement!", vbCritical)
End If
End Sub
'
' BTN_M3_BeiKlick Makro
'
'
Sub BTN_M3_BeiKlick()
If (measrun = False) Then
btn_m = 3
btn_r = 3
' ClearCells
' LockCells
Start_AMS
Else
Ans = MsgBox("Berthold AMS is currently performing a measurement!", vbCritical)
End If
End Sub
'
' BTN_R1_BeiKlick Makro
'
'
Sub BTN_R1_BeiKlick()
Call Blatt_aktiv
If (measrun = False) Then
btn_r = 1
ClearCells
UnLockCells
Else
pw.Stop_Measurement
measrun = False
'Ans = MsgBox("Berthold AMS is currently performing a measurement!", vbCritical)
End If
End Sub
'
' BTN_R2_BeiKlick Makro
'
'
Sub BTN_R2_BeiKlick()
Call Blatt_aktiv
If (measrun = False) Then
btn_r = 2
ClearCells
UnLockCells
Else
pw.Stop_Measurement
measrun = False
'Ans = MsgBox("Berthold AMS is currently performing a measurement!", vbCritical)
End If
End Sub
'
' BTN_R3_BeiKlick Makro
'
'
Sub BTN_R3_BeiKlick()
Call Blatt_aktiv
If (measrun = False) Then
btn_r = 3
ClearCells
UnLockCells
Else
pw.Stop_Measurement
measrun = False
'Ans = MsgBox("Berthold AMS is currently performing a measurement!", vbCritical)
End If
End Sub
Sub Blatt_aktiv()
Set Raum = ActiveSheet
End Sub
Sub NameDialog_BeiAnzeigen()
'ActiveDialog.[key].Text = ""
ActiveDialog.[UserName].Text = user
End Sub
Sub BTN_NameOK_BeiKlick()
user = ActiveDialog.[UserName].Text
End Sub
Sub BTN_NameABBR_BeiKlick()
user = ""
End Sub
Sub ClearCells()
Raum.Unprotect
Select Case btn_r
Case 1
Raum.Range("E19:H28") = ""
Raum.Range("G18") = ""
Raum.Range("H29") = ""
Raum.Range("I29") = ""
Case 2
Raum.Range("E33:H42") = ""
Raum.Range("G32") = ""
Raum.Range("H43") = ""
Raum.Range("I43") = ""
Case 3
Raum.Range("E47:H56") = ""
Raum.Range("G46") = ""
Raum.Range("H57") = ""
Raum.Range("I57") = ""
End Select
Raum.Protect
End Sub
Sub LockCells()
Raum.Unprotect
Select Case btn_r
Case 1
Raum.Range("A18:D28").Locked = True
Raum.Range("A18:D28").Interior.Color = RGB(255, 255, 255)
Raum.Range("I18:L28").Locked = True
Raum.Range("I18:L28").Interior.Color = RGB(255, 255, 255)
'Raum.Range("I18:I28").Interior.Color = RGB(255, 255, 255)
Case 2
Raum.Range("A32:D42").Locked = True
Raum.Range("A32:D42").Interior.Color = RGB(255, 255, 255)
Raum.Range("I32:L42").Locked = True
Raum.Range("I32:L42").Interior.Color = RGB(255, 255, 255)
Case 3
Raum.Range("A46:D56").Locked = True
Raum.Range("A46:D56").Interior.Color = RGB(255, 255, 255)
Raum.Range("I46:L56").Locked = True
Raum.Range("I46:L56").Interior.Color = RGB(255, 255, 255)
End Select
Raum.Protect
End Sub
Sub UnLockCells()
Raum.Unprotect
Select Case btn_r
Case 1
Raum.Range("A18:D28").Locked = False
Raum.Range("A18:D28").Interior.Color = RGB(255, 255, 192)
Raum.Range("I18:L28").Locked = False
Raum.Range("I18:L28").Interior.Color = RGB(255, 255, 192)
'Raum.Range("I18:I28").Interior.Color = RGB(255, 255, 255)
Case 2
Raum.Range("A32:D42").Locked = False
Raum.Range("A32:D42").Interior.Color = RGB(255, 255, 192)
Raum.Range("I32:L42").Locked = False
Raum.Range("I32:L42").Interior.Color = RGB(255, 255, 192)
Case 3
Raum.Range("A46:D56").Locked = False
Raum.Range("A46:D56").Interior.Color = RGB(255, 255, 192)
Raum.Range("I46:L56").Locked = False
Raum.Range("I46:L56").Interior.Color = RGB(255, 255, 192)
End Select
Raum.Protect
End Sub |
Partager