从 R 运行 VBA 脚本 [英] Run VBA script from R

查看:58
本文介绍了从 R 运行 VBA 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须管理一个涉及 R 脚本和 VBA 代码 的工作流.我想在 R(我的大部分代码所在的地方)中运行该过程,然后不时调用 VBA-code 进行特定计算.

I have to manage a workflow involving R-scripts and VBA-code. I would like to run the process in R (where most of my code is) and now and then to call VBA-code for specific calculation.

我会在 R 中为 VBA 准备输入,在某处写入结果(.csv、数据库),然后在 R 脚本的其余部分中使用结果.

I would prepare the inputs for VBA in R, write somewhere the results (.csv, database) and then use the results in the rest of the R-script.

当然最好是将整个代码移动到 R 中,但目前这是不可能的.VBA 代码 相当复杂.将其转换为 R 将是一项具有挑战性的长期任务.

The best would be of course to move the whole code into R but this is for now not possible. The VBA-code is fairly complex. Translating this into R will be a challenging long-term task.

是否有可能在 R 中管理这样的工作流程?

Is there any possibility to manage in R such a work-flow?

推荐答案

  1. 编写一个调用 VBA 的 VBscript 包装器.请参阅如何从命令行或批处理文件运行 Excel 宏?

通过 R 的 systemshell功能.

Run your VBscript via R's system or shell functions.

这篇关于从 R 运行 VBA 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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