我有一个我没有创建的MS Word 2010文档。
当您打开文档时,会出现一个小的“表单”弹出窗口,其中包含要填充的文本框。当用户单击表单上的“确定”按钮时,表单将填充Word文档。 'Form'是在Visual Basic中创建的。我有一张表格的图片,但看起来我还没有足够的重复点来发布它。
当用户点击“确定”按钮时,如何在名为“txtcnsl”的表单中创建TextBox?然后抛出一个警告错误或类似的东西,例如“你需要用xyz信息填写文本框”。表格的代码如下。看起来“确定”按钮名为“cmdOk_Click()”。我还会在哪里添加新代码?
Private Sub cmdCancel_Click()
Unload Me
ActiveDocument.Close SaveChanges:=False
End Sub
Private Sub cmdOk_Click()
With ActiveDocument
.Bookmarks("caseno").Range.Text = txtcaseno.Value
.Bookmarks("resp").Range.Text = txtresp.Value
.Bookmarks("resp2").Range.Text = txtresp.Value
.Bookmarks("barno").Range.Text = txtmember.Value
.Bookmarks("type").Range.Text = cbotype.Value
.Bookmarks("sbexh").Range.Text = txtsbexh.Value
.Bookmarks("rexh").Range.Text = txtrexh.Value
.Bookmarks("transno").Range.Text = txttransno.Value
.Bookmarks("respstreet").Range.Text = txtrespstreet.Value
.Bookmarks("respcity").Range.Text = txtrespcity.Value
.Bookmarks("cnsl").Range.Text = txtcnsl.Value
.Bookmarks("cnslstreet").Range.Text = txtcnslstreet.Value
.Bookmarks("cnslcity").Range.Text = txtcnslcity.Value
End With
Application.ScreenUpdating = True
Unload Me
ActiveWindow.View.ShowBookmarks = False
End Sub
Private Sub Frame1_Click()
End Sub
Private Sub Frame2_Click()
End Sub
Private Sub Label4_Click()
End Sub
Private Sub txtcaseno_Change()
End Sub
Private Sub txtcnsl_Change()
End Sub
Private Sub txtcnslcity_Change()
End Sub
Private Sub txtcnslstreet_Change()
End Sub
Private Sub txtresp_Change()
End Sub
Private Sub txtrespcity_Change()
End Sub
Private Sub txtrespstreet_Change()
End Sub
Private Sub UserForm_Initialize()
cbotype.AddItem "Rule 1-110 Violation Proceeding"
cbotype.AddItem "Reinstatement Proceeding"
cbotype.AddItem "Revocation of Probation Proceeding"
cbotype.AddItem "Conviction Proceeding"
cbotype.AddItem "Rule 9.20 Proceeding"
cbotype.AddItem "Original Proceeding"
cbotype.ListIndex = 0
End Sub
答案 0 :(得分:0)
extension ClassicLevelScene {
func startGame() { snake.direction = .up; moveSnake() }
func checkPlacement(for node: SKSpriteNode) -> SKAction {
return SKAction.run({
if !(node.isInsideFrame(of: self)) { self.gameOver() }
})
}
func getMovement(for node: SKDSpriteNode) -> (once: SKAction, repetitive: SKAction) {
let movement = SKAction.move(by: node.direction.getVector(withIntensity: movementSpeed), duration: 0.5)
let moveTail = SKAction.run({self.moveTail()})
let moveAction = SKAction.sequence([movement, moveTail,checkPlacement(for: node)])
let repetitiveMoveAction = SKAction.repeatForever(moveAction)
return (moveAction, repetitiveMoveAction)
}
func moveTail()
{
for i in 1..<snake.length {
snakeBody[i].direction = snakeBody[i-1].direction
snakeBody[i].position = snakeBody[i-1].oldPosition
}
}
func moveSnake() {
let head = snakeBody[0] {
head.removeAllActions()
head.run(getMovement(for: head).1)
}
}
func moveOnce() {
let head = snakeBody[0] {
head.removeAllActions()
head.run(getMovement(for: head).0)
}
}
func changeDirection() {
let head = snakeBody[0] {
head.removeAllActions()
head.direction = snake.direction
head.run(SKAction.move(by: head.direction.getVector(withIntensity: movementSpeed), duration: 0.5))
}
}