insertrowrange始终在Excel 2007 vba中不返回任何内容 [英] insertrowrange always returns nothing in Excel 2007 vba

查看:84
本文介绍了insertrowrange始终在Excel 2007 vba中不返回任何内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Excel 2003中,我可以使用ListObject.InsertRowRange属性来定位我的选择,以便将新数据插入到列表中(2003)(或excel表(2007))

代码段:

将mylo调暗为列表对象
将暗淡的myLoRowRng作为范围
将暗淡的myPlaceholderRow作为ListRow

设置myLO = TimeTrackingData.ListObjects(1)
设置myPlaceholderRow = myLO.ListRows(myLO.ListRows.Count)
myPlaceholderRow.Range.Activate
设置myLoRowRng = myLO.InsertRowRange

在这种情况下,myLoRowRng.Address是范围只要myLO.Active评估为TRUE,就可以使用InsertRowRange。

在Excel 2007中,使用与上面相同的代码,myLO.InsertRowRange始终返回"nothing"。即使我的ListObject.Active属性计算为TRUE。此外,在Excel 2007中,"插入行"表示"插入行"。永远不可见(即标有星号"*")。 Excel 2007 VBA帮助和Excel 2007对象模型都指示InsertRowRange属性存在且不被弃用。实际上是否删除了此功能?

是否有其他人能够使用insertrowrange属性?

解决方案

来自technet:


表:插入行



描述:列表功能Office Excel 2003底部有一个特殊行,用于向列表中添加新记录。在Office Excel 2007中删除此特殊行。而是,当活动选择位于表的最后一个数据行时,可以使用ENTER和TAB键将数据添加到表中。您还可以拖动表格右下角的调整大小手柄以添加更多行。在Office Excel 2003中使用ListObject对象编写代码的开发人员可能需要进行调整,如果该代码使用ListObject.InsertRowRange。

http://technet.microsoft.com/en-us/library/cc179167.aspx


In Excel 2003, I could use the ListObject.InsertRowRange property to position my selection for inserting new data into a list (2003) (or excel table (2007))

code snippet:

Dim myLO As ListObject
Dim myLoRowRng As Range
Dim myPlaceholderRow As ListRow

Set myLO = TimeTrackingData.ListObjects(1)
Set myPlaceholderRow = myLO.ListRows(myLO.ListRows.Count)
myPlaceholderRow.Range.Activate
Set myLoRowRng = myLO.InsertRowRange
   
In this case, myLoRowRng.Address is the range of the InsertRowRange as long as myLO.Active evaluated to TRUE.

In Excel 2007, using the same code as above, myLO.InsertRowRange always returns "nothing" even though my ListObject.Active property evaluates to TRUE.  Also, in Excel 2007, the "insert row" is never visible (i.e. marked with an asterisk "*").  The Excel 2007 VBA help and Excel 2007 Object model both indicate that the InsertRowRange property exists and is not deprecated.  Has this functionality actually been removed?

Has anyone else been able to use the insertrowrange property?

解决方案

From technet:

Tables: Insert row

Description: The List feature in Office Excel 2003 had a special row at the bottom to add new records to the list. This special row is removed in Office Excel 2007. Instead, you can add data to a table by using the ENTER and TAB keys when the active selection is in the last data row of the table. You can also drag the resize handle at the bottom-right corner of the table to add more rows. Developers who have written code by using the ListObject object in Office Excel 2003 might need to make adjustments if that code uses ListObject.InsertRowRange.

http://technet.microsoft.com/en-us/library/cc179167.aspx


这篇关于insertrowrange始终在Excel 2007 vba中不返回任何内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆