I've learned a bit of VC programming knowledge, but the online data shows, the best is to use VB to write is better, and using the vba macros in the office they will be more simple to implement, learn a period of time, have some idea how much vba, but at the time of application or met some problem, hope to show just a little down,
The questions below about a WORD operation requirements:
Headline is set to 1 will be the first line: "center", "3", "blue", and sets the background color to: "green", (5)
2. Set all text paragraphs to: first line indented two characters, with row spacing of: 18 pounds a fixed value, (3)
3. The document page setup for: A4 paper, upper and lower margins are about 2.1 cm, margins are 2.5 cm (5 points)
Inserts a 2 line 4. In the last three columns of the table, the outer border lines of 1.5 pounds of red double, single border lines within 0.5 pounds of green, (2)
To the problem during the third step, record macro code is:
With ActiveDocument. Styles (wdStyleNormal). The Font
If. NameFarEast=. NameAscii Then
. NameAscii=""
End the If
. NameFarEast=""
End With
With ActiveDocument. PageSetup
. LineNumbering. Active=False
The Orientation=wdOrientPortrait
. TopMargin=CentimetersToPoints (2.1)
. BottomMargin=CentimetersToPoints (2.1)
. LeftMargin=CentimetersToPoints (2.5)
. RightMargin=CentimetersToPoints (2.5)
The Gutter=CentimetersToPoints (0)
. HeaderDistance=CentimetersToPoints (1.5)
. FooterDistance=CentimetersToPoints (1.75)
. PageWidth=CentimetersToPoints (21)
PageHeight=CentimetersToPoints (29.7)
. FirstPageTray=wdPrinterDefaultBin
. OtherPagesTray=wdPrinterDefaultBin
. SectionStart=wdSectionNewPage
. OddAndEvenPagesHeaderFooter=False
. DifferentFirstPageHeaderFooter=False
The VerticalAlignment=wdAlignVerticalTop
. SuppressEndnotes=False
. MirrorMargins=False
. TwoPagesOnOne=False
. BookFoldPrinting=False
. BookFoldRevPrinting=False
. BookFoldPrintingSheets=1
. GutterPos=wdGutterPosLeft
. LayoutMode=wdLayoutModeLineGrid
End With
According to the record macro code, determine the correct code can be written as the following:
'STR for output
'judgment matrix
If ActiveDocument. PageSetup. PageWidth=CentimetersToPoints (21) and ActiveDocument. PageSetup.. PageHeight=CentimetersToPoints (29.7) Then
STR=STR & amp; VbCrLf & amp; "3 sets the document page to A4 paper -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- right"
The Else
STR=STR & amp; VbCrLf & amp; "3 sets the document page to A4 paper -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - not correct"
End the If
'margins, just experiment to determine a top margin
If ActiveDocument. PageSetup. TopMargin=CentimetersToPoints (2.1) Then
STR=STR & amp; VbCrLf & amp; "3 margins -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- right"
The Else
STR=STR & amp; VbCrLf & amp; "3 margins -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- not correct"
End the If
Judgment matrix results output is not correct, to find a little bit of information from the Internet, finally, the conditions of if statements to ActiveDocument. PageSetup. PaperSize=wdPaperA4 can judge correctly, but set margins but how also not solve, use the conditions how to also could not have the correct output as a result, I don't know what is the use conditions to determine, please master action,
CodePudding user response:
QQ: 5507350I have been working for the ATA, specialized production test question,
Can cooperation,
CodePudding user response:
Not leave QQ?