新手请教——VB如何获取插入的BuildingBlock内容并删除

SharonSh 2013-09-04 11:59:21
大家好,我是刚接触word开发与VBA的菜鸟,手头上有个关于改写现有模板的紧急任务,目的是把原来模板中重复调用的内容用Buildingblock的形式存放并在宏中进行调用。
我已经在word菜单栏中创建了这些buildingblock,category为"MyTask",类型为“QuickParts",并且能够顺利插入这些buildingblock到文档中,代码如下
Public objTemplate As Template
Public objBB As BuildingBlock
Sub InsertExpandCollapseSection
' Set the template to store the building block
Set objTemplate = ActiveDocument.AttachedTemplate

' Access the building block through the type and category
Set objBB = objTemplate.BuildingBlockTypes(wdTypeQuickParts).Categories("MyTask").BuildingBlocks("InsertExpandCollapseSection")
' Insert the building block into the document
objBB.Insert Selection.Range
End Sub

但还有个功能是撤销之前插入的buildingblock(例如上面的InsertExpandCollapseSection),类似于word本身的undo功能,我大概知道应该用数组array作为中间变量去存储插入的内容,但不知道代码该怎么实现?主要不知道该用什么类型的数组以及如何取得插入的buildingblock的内容,请大虾们指点,小女子感激不尽!
...全文
203 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
meilk2009 2013-09-18
  • 打赏
  • 举报
回复
无法获得buildingblock插入的内容作为数组存储,建议在外面套个表格作为数组存储
SharonSh 2013-09-06
  • 打赏
  • 举报
回复
为什么都没人啊?难道是因为分数给低了?第一次来这问问题,不知道怎么调整分数
SharonSh 2013-09-06
  • 打赏
  • 举报
回复
终于找到加分的地方了,可是给了我所有分数的一半了,希望大虾们来看一下,救下急,不胜感激!
SharonSh 2013-09-05
  • 打赏
  • 举报
回复
没有人吗?

2,462

社区成员

发帖
与我相关
我的任务
社区描述
VBA(Visual Basic for Applications)是Visual Basic的一种宏语言,是在其桌面应用程序中执行通用的自动化(OLE)任务的编程语言。
社区管理员
  • VBA
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧