VBA Annotations Temporary

Source: Internet
Author: User

Sub Shishi () ' defines the answer according to ABCDE for multiple choice questions; ' A Thalidomide B. Isoniazid C. Rifampicin ' d. Chloride method aplanatic E. Ammonia phenyl sulfone ' 46. The preferred drug for each type of leprosy is (D) ' A. Thalidomide B. Isoniazid C. Rifampicin ' d. Chloride method aplanatic E. Ammonia phenyl sulfone ' 45. The preferred drug for each type of leprosy is (E) ' A. Thalidomide B. Isoniazid C. Rifampicin ' d. Chloride method aplanatic E. Ammonia phenyl sulfone ' 45645 ' 1532131 ' 46. The preferred drug for each type of leprosy is (D) Dim MT, MH, MK, orng as range, RG as range, n&, M&, str$, D, rng as Range ', t Set D = Createo Bject ("scripting.dictionary") y = 4 with CreateObject ("VBScript.RegExp"). Global = True:. IgnoreCase = False:. MultiLine = True. Pattern = "^\d+." [^\r]+\ ([a-e]) \ \ r (?:(?! ^\d+. [^\r]+\ ((?: [a-e]) \) \ r).) + "' match the problem with the dry + option (non-dry multiple lines until the second one is dry), there are several groups for each MT in.            Execute (activedocument.content) y = y + 1 ' This is the initial problem number; m = Mt. FIRSTINDEX:N = Mt.            Length45. The preferred drug for each type of leprosy is (E) Set orng = ActiveDocument.Range (m, m + N) ' orng for the dry + option;            str = mt.submatches (0) ' Str is the answer to the problem; . Pattern = "([A-E]. )((?:(?! [A-E]. ).)            +) "' Match ABCDE option; For each MH in. Execute (orng.text) m = mh. Firstindex:n = MH. Length SetRG = ActiveDocument.Range (Orng.start + M, Orng.start + M + N) ' RG for specific options; Set D (Left (RG).            Text, 1) = RG ' creates correspondence between a and a option within the dictionary;            Next t = D.items ' item can only have 5, corresponding to a-e5 options, i.e. t (0)-T (4);            Select Case y Mod 5 ' is a multiple of 5 assigns a, the remainder is 1 to allocate B, others and so on; 4 is e; Case 0 If str <> ' A ' then. Pattern = "\ (\s*[a-e]\s*\)" for each MK in. Execute (orng.text) m = Mk. Firstindex:n = Mk.                        Length Set rng = ActiveDocument.Range (Orng.start + M, Orng.start + M + N) ' usually two times the regular lookup needs to be added two times; With RNG. MoveStart 1, 1:. MoveEnd 1,-1:.                        Text = "A" is moved from outside the brackets to the parentheses;                        End with Next with D (str) ' Dictionary pointing to Range Object (remote control); . MoveStart 1, 2:. MoveEnd 1, -1:s1 =. The Text ' starting point moves backwards by 2, and the last point moves forward 1; Is it possible to write D.itme (1) in the end With with T (0)?      That must be written in Ahk;                  . MoveStart 1, 2:. MoveEnd 1, -1:s2 =. Text. Text = S1 End with D (str).            Text = s2 End If ' above is the exchange of two options content, and the option itself is unchanged;                Case 1 ' is the rest of the repetitive operation, the real core is the above part of the code; If str <> "B" then. Pattern = "\ (\s*[a-e]\s*\)" for each MK in. Execute (orng.text) m = Mk. Firstindex:n = Mk. Length Set rng = ActiveDocument.Range (Orng.start + M, Orng.start + M + N) Wi Th rng. MoveStart 1, 1:. MoveEnd 1,-1:. Text = "B" End with Next with D (str). MoveStart 1, 2:. MoveEnd 1, -1:s1 =. Text End with with with T (1). MoveStart 1, 2:. MoveEnd 1, -1:s2 =. Text.               Text = S1 End with     D (str). Text = S2 End if case 2 if str <> ' C ' then. Pattern = "\ (\s*[a-e]\s*\)" for each MK in. Execute (orng.text) m = Mk. Firstindex:n = Mk. Length Set rng = ActiveDocument.Range (Orng.start + M, Orng.start + M + N) Wi Th rng. MoveStart 1, 1:. MoveEnd 1,-1:. Text = "C" End with Next with D (str). MoveStart 1, 2:. MoveEnd 1, -1:s1 =. Text End with with with T (2). MoveStart 1, 2:. MoveEnd 1, -1:s2 =. Text. Text = S1 End with D (str). Text = S2 End if case 3 if str <> ' D ' then. Pattern = "\ (\s*[a-e]\s*\)" for each MK in. Execute(orng.text) m = Mk. Firstindex:n = Mk. Length Set rng = ActiveDocument.Range (Orng.start + M, Orng.start + M + N) Wi Th rng. MoveStart 1, 1:. MoveEnd 1,-1:. Text = "D" End with Next with D (str). MoveStart 1, 2:. MoveEnd 1, -1:s1 =. Text End with with with T (3). MoveStart 1, 2:. MoveEnd 1, -1:s2 =. Text. Text = S1 End with D (str). Text = S2 End If case 4 if str <> ' E ' then. Pattern = "\ (\s*[a-e]\s*\)" for each MK in. Execute (orng.text) m = Mk. Firstindex:n = Mk. Length Set rng = ActiveDocument.Range (Orng.start + M, Orng.start + M + N) Wi   Th rng                         . MoveStart 1, 1:. MoveEnd 1,-1:. Text = "E" End with Next with D (str). MoveStart 1, 2:. MoveEnd 1, -1:s1 =. Text End with with with T (4). MoveStart 1, 2:. MoveEnd 1, -1:s2 =. Text. Text = S1 End with D (str). Text = S2 End If End Select D.removeall Next End withend Sub

  

VBA Annotations Temporary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.