使用 VBA 将图像从一张纸的页眉/页脚复制到另一张纸

发布于 2024-07-22 09:22:04 字数 74 浏览 1 评论 0 原文

我需要编写一个 VBA 代码,将一个 Excel 工作表的页眉/页脚中的公司徽标复制到另一个工作簿中的另一个工作表。 有任何想法吗?

I need to write a VBA code to copy a company logo in the headers/footers of one excel sheet to another sheet in another workbook. Any ideas?

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

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

发布评论

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

评论(3

任性一次 2024-07-29 09:22:04

Excel有一个方便的记录宏功能。

您可以启动该操作,将页脚复制过来,然后停止录制。

然后,查看代码,它应该会告诉您如何做到这一点。

Excel has a handy Record Macro function.

You can initiate that, Copy the footer over, then stop the recording.

Then, review the code, and it should pretty much show you how to do it.

混浊又暗下来 2024-07-29 09:22:04

如果您使用的是 Excel 2007 之前的版本,那么如果不使用原始图形文件(例如 JPG、GIF 等),这听起来是不可能的:

通常,您可以复制并粘贴
一张工作表的页眉和页脚
通过选择工作表到另一个
然后使用页眉或页脚
对话框(单击“自定义标题”或
页眉/页脚选项卡上的自定义页脚
页面设置对话框)。
但是,如果原始标头和
页脚包含图形,图形
不会传播给其他人
工作表。 合作的唯一方式
页眉或页脚中的图片
多个工作表就是选择全部
工作表,然后插入
使用插入图片绘制图形
对话框(单击插入图片
按钮),或通过以下方式格式化图形
使用“设置图片格式”对话框
(单击“设置图片格式”按钮)。 这
需要原始图形文件
这个过程。

来源

在 Excel 2007 中可能有可能 - 请参阅此处

If you are working in anything older than Excel 2007 then it doesn't sound like this is possible without using the original graphic file (e.g. JPG, GIF etc):

Normally, you can copy and paste the
headers and footers from one worksheet
to another by selecting the worksheets
and then using the Header or Footer
dialog boxes (click Custom Header or
Custom Footer on the Header/Footer tab
of the Page Setup dialog box).
However, if the original headers and
footers contain graphics, the graphics
will not propagate to the other
worksheets. The only way to work with
pictures in headers or footers for
multiple worksheets is to select all
the worksheets, and then insert a
graphic by using the Insert Picture
dialog box (click the Insert Picture
button), or format the graphic by
using the Format Picture dialog box
(click the Format Picture button). The
original graphic file is needed for
this procedure.

source

It may be possible in Excel 2007 - see here

匿名。 2024-07-29 09:22:04

一种解决方法是将原始工作表复制到工作簿:

   ' macro on the source workbook
    Sheets("Sheet1").Move After:=Workbooks("Book2").Sheets(3)

执行此操作时,您会在目标工作簿中获得一个工作表,其中包含原始工作表的所有功能,包括页脚和标题,然后您可以将所需的所有内容复制到新工作表中

One workaround is to copy the original worksheet to the new workbook:

   ' macro on the source workbook
    Sheets("Sheet1").Move After:=Workbooks("Book2").Sheets(3)

When you do this, you get a worksheet in the destination workbook with all the features of the original, including footers and headers, you can then copy all the content you want into the new worksheet

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