gpt4 book ai didi

excel - 将 ActiveCell.Address 读入 Outlook

转载 作者:行者123 更新时间:2023-12-03 03:35:25 25 4
gpt4 key购买 nike

如何将 Excel 中事件单元格的地址存储到 Outlook 中的变量中?

Outlook 正在操作工作簿,我想在操作后将事件单元格恢复到其原始位置。

Set xl = GetObject(, "Excel.Application")
Set xlB = xl.Workbooks("DWG_CHECKLIST")
reactivateMeSheet = xlB.ActiveSheet.Name
reactivateMeCell = xlB.Sheets(reactivateMeSheet).ActiveCell.Address

我引用了 Excel 15 对象库。

最佳答案

如果您在治疗前使用 Range 变量来存储初始细胞,会更容易,
这样你只需要像这样包装你的代码:

Set xl = GetObject(, "Excel.Application")
Set xlB = xl.Workbooks("DWG_CHECKLIST")

Dim reactivateMeCell As Object 'Excel.Range
xlB.Activate
Set reactivateMeCell = xl.ActiveCell

'''Your code

With reactivateMeCell
.Parent.Parent.Activate
.Parent.Activate
.Activate
End With 'reactivateMeCell

关于excel - 将 ActiveCell.Address 读入 Outlook,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43943915/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com