在Access 2010中使用Currentregion属性 [英] Use Currentregion Property in Access 2010

查看:119
本文介绍了在Access 2010中使用Currentregion属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我正在Access 2010中编写一个模块,以在Excel文件中创建数据透视表。我经常使用"currentregion.rows.count"。在Excel vba中选择一个动态范围,当我尝试在Access模块​​中使用下面的时候,我不断收到一条错误消息:
我错过了一个括号(但我没有看到丢失的地方)。


我做错了什么?你可以在Access VBA中使用currentregion,如果可以的话,正确的语法是什么?



设置SourceRange = ActiveWorkbook.Worksheets(" C :\ Auto Reports \BD_EOD \Daily_Galaxy Template2.xlsx).Range(" A2:A"& cells.currentregion.rows.count")





Lorac1969

解决方案

Access对Excel和Excel方法一无所知,性质.... 所以它不知道你说的是什么ActiveWorkbook。 你需要在你的对象前加上所有内容。


看一下我的一些示例代码来激发你自己,看看
http://www.devh ut.net/2017/03/15/ms -access-VBA的出口记录到Excel /


Hello,

I'm writing a module in Access 2010 to creat a pivot table in an Excel file. I've often used "currentregion.rows.count" in Excel vba to select a dynamic range, when I try to use the below in the Access module I keep getting an error message that I'm missing a parenthesis (but I don't see where one is missing).

What I'm I doing wrong? Can you use currentregion in Access VBA, if you can, what is the proper syntax?

Set SourceRange = ActiveWorkbook.Worksheets("C:\Auto Reports\BD_EOD\Daily_Galaxy Template2.xlsx).Range("A2:A" & cells.currentregion.rows.count")


Lorac1969

解决方案

Access does not know anything about Excel and Excel methods, properties....  so it does not know what ActiveWorkbook you talk about.  You need to prefix everything with your objects.

Take a look at some of my sample code to inspire yourself, see http://www.devhut.net/2017/03/15/ms-access-vba-export-recordset-to-excel/


这篇关于在Access 2010中使用Currentregion属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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