如何在C#中实现VBA的application.inputbox [英] How do I implement VBA's application.inputbox in C#

查看:213
本文介绍了如何在C#中实现VBA的application.inputbox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下Excel VBA声明:

I have the following Excel VBA statement:

Set yRange = Application.InputBox("select Y range and labels", "y range", , , , , , 8)



我想在我正在开发的C#excel插件中实现相同的操作。也就是说,我想将范围对象设置为电子表格中突出显示的单元格。有什么想法吗?



我的尝试:



我是搜索C#Excel输入框,C#选择范围和几个相关搜索。


I want to implement the same action in a C# excel addin I am developing. That is, I want to set a range object to the cells highlighted in a spreadsheet. Any ideas?

What I have tried:

I've searched on C# Excel InputBox, C# select range and several related searches.

推荐答案

您的Google-fu需要工作。



C#输入框 [ ^ ]
Your Google-fu needs work.

C# InputBox[^]


这是我做的,它的工作原理。输入框返回Excel范围。

Here's what I did and it worked. The input box returns an Excel range.
Excel.Workbook p_book
private void get_data()
{
    Excel.Range Y_range;
    Excel.Range X_range;
    object missing = Type.Missing;
    Y_range = p_book.Application.InputBox
        ("select Y range", "y range", missing, missing, missing,
        missing, missing, 8);
    X_range = p_book.Application.InputBox
        ("select X range", "x range", missing, missing, missing,
        missing, missing, 8);
}


这篇关于如何在C#中实现VBA的application.inputbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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