Home > database >  PB excuse me this code ole_object. Selection. MoveLeft (1, len (s), 1)
PB excuse me this code ole_object. Selection. MoveLeft (1, len (s), 1)

Time:09-17

PB is excuse me this code ole_object. Selection. MoveLeft (1, len (s), 1) is what meaning, more detailed, the better,
And I want to control was derived from the data window table data and control the font size, and detailed code, novice nothing,,,, the great god appeared

CodePudding user response:

The
refer to the original poster xunuoqing response:
PB. Could you tell me this code ole_object Selection. MoveLeft (1, len (s), 1) is what meaning, more detailed, the better,
And just derived from the data window is what I want to control the form data and control the font size, and a detailed code, novice nothing,,,, the great god appeared


This call a VBA function, general is the word, refer to help the following


Word VBA tutorial: MoveLeft method
Move the selected content to the left, and returns the distance moved on the number of units,

Expression. MoveLeft (Unit, the Count, the Extend)

Expression required, the expression returns a Selection object,

Unit WdUnits, optional, the selected content mobile Unit of measure of the distance,

Can be one of the following WdUnits constants:

WdCell

WdCharacter

WdWord

WdSentence

The default value is wdCharacter,

Count the Variant type, optional, the selected content mobile distance is the number of units, the default value is 1,

Extend the Variant type, optional, can be wdMove or wdExtend, if wdMove, folding the selected content to the end position, and is moving to the left, if it is wdExtend, Extend the selected content to left, the default value is wdMove,

Description

If the Unit is wdCell, Extend parameters can only be wdMove,

VBA example

This example will move the selected content to the left one character at a time, if the move is successful, the MoveLeft method returns 1,


If Selection. MoveLeft=1 Then MsgBox "Move was successful"
This example to activate the selected domain domain background function, and insert the DATE field, then the selected content to mobile, to select the domain,


ActiveDocument. ActiveWindow. The FieldShading=_
WdFieldShadingWhenSelected
With Selection
. Fields. The Add Range:=Selection. The Range, Type:=wdFieldDate
. MoveLeft Unit:=wdWord, Count:=1
End With
This example will be before the content to the form of a cell,


If Selection. Information (wdWithInTable)=True Then
Selection. MoveLeft Unit:=wdCell, Count:=1, the Extend:=wdMove
End the If

CodePudding user response:

Well,,, thank you for your answer, but I don't quite understand, can you help me to write code to realize such functions: I already form is derived from the data window, now I want to be in PB to control, such as font size, can give a detailed example,,,