1.在word里用程序如何插入一个选种和未选种的checkbox,而且这个checkbox边框可以大一些。
2.我插入表格数据用 WordTab.Cell(1, 2).Range.InsertAfter "100"
但是我想在比如一个格中"第 号定单, 总计 元"插入怎么做,变成"第 100 号定单, 总计 500元"
2.我插入表格数据用 WordTab.Cell(1, 2).Range.InsertAfter "100"
但是我想在比如一个格中"第 号定单, 总计 元"插入怎么做,变成"第 100 号定单, 总计 500元"
解决方案 »
- 查找字符串的个数
- 服务器上的一个SQLSERVER数据库,想在本地机上保存属于本地机的数据备份,当心服务器出问题时的数据丢失。如何不写代码直接备份,即在给服务器存记录时也同时给本地机存一份,不写同样的代码或少量写代码能实现吗?
- 如何调用VB编写的DLL中的图片/图标资料? --在线等待,每5分钟查看一次,即结贴;
- 多條件的判斷問題
- ???吴军印进!!!
- 二百分求,VB程序中一条select语句的提速与优化方法!!
- 求助~~~~~~~~VB连接SQL时候 感觉CONN没有打开
- 无法访问已释放的对象
- 为什么在2000下把文件从NT分区复制到FAT分区,在98下文件名显示第一个字母全大写?
- 三角网的做法?
- Access与Sql Sever比较时间的问题。欢迎指导
- 请教vb 数组访问效率问题
Sub Macro1()
Selection.InlineShapes.AddOLEControl ClassType:="Forms.CheckBox.1"
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.InlineShapes.AddOLEControl ClassType:="Forms.CheckBox.1"
Selection.MoveDown Unit:=wdLine, Count:=1
ActiveDocument.InlineShapes(2).OLEFormat.Object.Value = True
ActiveDocument.InlineShapes(2).OLEFormat.Object.FontSize = 18
End Sub
ActiveDocument.Tables(1).Cell(1, 1).Range.InsertAfter "第 号定单, 总计 元"End SubSub macro2()
ActiveDocument.Tables(1).Cell(1, 1).Range.Characters(2).InsertAfter 100
ActiveDocument.Tables(1).Cell(1, 1).Range.Characters(16).InsertAfter 500
End Sub
然后在代码里,往那个域写内容,然后更新域。否则你用别的方法,如果内容的位置变了,你不是要改代码????
再帮下忙,就是这个checkbox我说的是边框变大,不是文字变大,
----------------------'引用Microsoft word X.0 Object Library
' Add a commandbutton and copy the following codes to form1Dim wordapp As New Word.Application
Dim mydoc As New Word.Document
Private Sub Command1_Click()
wordapp.Visible = True
Set mydoc = wordapp.Documents.Add(DocumentType:=wdNewBlankDocument)
mydoc.InlineShapes.AddOLEControl ClassType:="Forms.CheckBox.1"
mydoc.InlineShapes.AddOLEControl ClassType:="Forms.CheckBox.1"
mydoc.InlineShapes(2).OLEFormat.Object.Value = True
End SubPrivate Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Set mydoc = Nothing
wordapp.Quit
Set wordapp = Nothing
End Sub
再帮下忙,就是这个checkbox我说的是边框变大,不是文字变大
----------------------------------
明白你意思了,很麻烦.
建议用两个LABEL来模拟
' Add a commandbutton and copy the following codes to form1Dim wordapp As New Word.Application
Dim mydoc As New Word.DocumentPrivate Sub Command1_Click()
wordapp.Visible = True
Set mydoc = wordapp.Documents.Add(DocumentType:=wdNewBlankDocument)
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=5, NumColumns:=2, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:=wdAutoFitFixed
ActiveDocument.Tables(1).Cell(1, 1).Range.InsertAfter "第 号定单, 总计 元"
ActiveDocument.Tables(1).Cell(1, 1).Range.Characters(2).InsertAfter 100
ActiveDocument.Tables(1).Cell(1, 1).Range.Characters(16).InsertAfter 500
End SubPrivate Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Set mydoc = Nothing
wordapp.Quit
Set wordapp = Nothing
End Sub
顺便问最后一个问题:
1.就是cell(1,1)由于word版本问题不确定,
|————————————————
| | 标题 1| 标题2 |
| |----------------------
| | 所在区1 | 所在区11 |
| |————————————
| | 所在区2 | 所在区22 |
|———— |————————————
如上面 “所在区”,我家中机器编码时(office2000),所在区1为 .cell(2,1)
所在区11为 .cell(2,2) 所在区2为.cell(3,1)
我在单位是office xp ,所在区1为 .cell(2,2) 所在区11为.cell(2,3),
所在区2为.cell(3,2) 所在区2为.cell(3,3)
我总结下,就是word2000,从第二行开始不算竖的那行开始算起,而xp则每行都从竖算起,
这样我的程序就每次都改来改去,将来怎么到客户那里用啊,你们怎么解决的?2."第 号定单, 总计 元"就是插入后能不能不让他们后退啊,象第 100 号定单, 总计 元,而有时 第 100 号定单, 总计 元,象后退了几位字符,改变了原来的位置。
' Add a commandbutton and copy the following codes to form1Dim wordapp As New Word.Application
Dim mydoc As New Word.DocumentPrivate Sub Command1_Click()
wordapp.Visible = True
Set mydoc = wordapp.Documents.Add(DocumentType:=wdNewBlankDocument)
ActiveDocument.Tables.Add Range:=selection.Range, NumRows:=5, NumColumns:=2, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:=wdAutoFitFixed
ActiveDocument.Tables(1).Cell(1, 1).Range.InsertAfter "第 号定单, 总计 元"
ActiveDocument.Tables(1).Cell(1, 1).Range.Characters(1).Select
With selection
.MoveRight Unit:=wdCharacter, Count:=1
.MoveRight Unit:=wdCharacter, Count:=3, Extend:=wdExtend
.TypeText Text:="100"
.MoveRight Unit:=wdCharacter, Count:=7
.MoveRight Unit:=wdCharacter, Count:=3, Extend:=wdExtend
.TypeText Text:="500"
End With
End SubPrivate Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Set mydoc = Nothing
wordapp.Quit
Set wordapp = Nothing
End Sub