从 Access 打开 Excel 文件并将图片复制到 Access 表单

发布于 2024-08-26 23:44:50 字数 969 浏览 4 评论 0原文

所以我有一个 Excel 工作簿,其中有一个很好的 shaperange 对象的全局地图。通过一些非常简单的代码,我可以更改颜色、将国家/地区集合分组和取消分组为数组等......并且效果非常好。不过,我想把它带入 Access 中。

因此,我可以手动将所有形状复制并粘贴到访问表单中,但随后它们会变成图片,并且我无法更改国家/地区(shaperange 对象)的颜色以使地图像在 Excel 中那样进行交互操作。

所以我想我知道如何使用access中的excel函数,以及如何从access中打开excel。有没有办法从 Excel 复制对象(我知道每次复制的文件名和形状名称),然后将其带回访问以粘贴到表单上?

我知道,我所有的 Access 问题都是非典型的。谢谢!

编辑:

我很乐意详细阐述我半疯狂的想法。所以我知道如何打开一个新的 Excel 实例,或在幕后打开一个模板(实际上不使其可见)。我知道如何使用 vba 从访问模块执行 Excel 任务......甚至从访问运行公式和 Excel 函数。我有一个与 Excel 模块一起使用的交互式地图程序,但我想让它们成为访问表单的一部分。

因此,为了回答下面的问题,如果我可以找到从 Excel 复制和图像/shaperange 对象缺少的链接,并将其复制到访问表单中,那么我可以编写代码,始终从我的 Excel 模板中获取形状格式化形状在复制并粘贴到访问表单之前在 Excel 中,可以在其中进行布局格式化。当用户在表单上选择某些内容时,我想包含具有相对颜色/阴影等的全局地图区域...访问将始终从文件/中的对象集合中获取所需的预定义地图片段excel 模板。我的想法是在选择之后,我将格式化形状,就像我对 vba 所做的那样,然后将 ole.copy 和 ole.paste 返回到访问表单中。如果当时是一张照片,那也没关系。至少对于形状本身来说

有很多代码,但我认为值得尝试将 Excel 和这个基于 shaperange 对象的地图合并到像访问表单这样的表单环境中!很奇怪,但可能效果很好?一些奇怪的非典型事物已成为我的访问数据库中的主要内容。

So I have an excel workbook that has a nice global map of shaperange objects. With some very simple code I can change the colors, group and ungroup collections of countries into arrays, etc...and it works pretty well. However, I would like to bring this into Access.

So I could copy and paste all the shapes into an access form manually, but then they become pictures and I cannot change the colors of the countries (shaperange objects) to have the map act interactively as I can in excel.

So I am thinking that I know how to use excel functions from access, and how to open excel from access. Is there a way to copy an object from excel (I know the file name and the shape name that i mean to copy everytime), and bringing it back to access to paste on a form?

Atypical, I know, all my Access questions are. Thanks!

EDIT:

I would be happy to elaborate my half crazy idea. So I know how to open a new excel instance, or open a template behind the scene (w/o actually making it visible). And I know how to use vba to preform excel tasks, from access modules.....or even run formulas and excel functions from access. i have this interactive map program that works with excel modules, but I would like to make them a part of an access form.

So to answer the below question, if I can just find the missing link with copying and image/shaperange object from excel, and copying it into access form, then I can write code that will always grab the shapes from my excel template format the shapes in excel before copying and pasting into access form, where layout formatting can take place. when a user selects something on a form were I want to include an area of a global map with relative colors/shading, etc...access will always get the pre-defined map pieces it needs from a collection of object in a file/excel template. My idea was after the selection, I would format the shapes, just like I already do with vba, then ole.copy and ole.paste back into the access form. If it is a picture at that point, it doesn't matter. Atleast for the shape itself

lots of code but i think it is worth a try to try to incorporate excel and this shaperange object based map into a form enviroment like the access forms! Pretty strange but it might work well?? Some weird atypical things have become staples in my access database.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

居里长安 2024-09-02 23:44:50

好吧,你问这个:

“所以我可以手动复制所有形状并将其粘贴到访问表单中,但随后它们变成图片并且我无法更改国家/地区的颜色(shaperange 对象) )让地图像在 Excel 中一样进行交互操作。

“所以我认为我知道如何从 Access 使用 Excel 函数,以及如何从 Access 打开 Excel。有没有办法从 Excel 复制对象(我知道每次复制的文件名和形状名称),然后将其带回访问以粘贴到表单上?”

也许一些潜在的响应者会问自己,为什么当前的解决方案不足以粘贴到 Access 表单中,因为“然后它们就变成了图片”,但是可以自动化您认为不合格的相同过程,

也许可以重新表述问题 。会有帮助的。

Well you're asking this:

"So I could copy and paste all the shapes into an access form manually, but then they become pictures and I cannot change the colors of the countries (shaperange objects) to have the map act interactively as I can in excel.

"So I am thinking that I know how to use excel functions from access, and how to open excel from access. Is there a way to copy an object from excel (I know the file name and the shape name that i mean to copy everytime), and bringing it back to access to paste on a form?"

Maybe some potential responders are asking themselves why if the present solution is not good enough to paste into an Access form because "then they become pictures," but it's okay to Automate the same procedure that you believe is substandard.

Maybe rephrasing the question would help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文