【问题标题】:Can I access some libraries used by Excel in Perl?我可以在 Perl 中访问一些 Excel 使用的库吗?
【发布时间】:2014-05-21 13:23:44
【问题描述】:

我们在 Excel 中有几个宏。在 excel 的引用中有一个名为 SiebelHtml Type Libary 的文件或类似的东西。当它包含在 Excel 中时,它会加载许多函数和类。

例如

sApp as SiebelApplication

当我包含库时编译。我在目录中找到了两个文件。它们是 SiebelAX_Desktop_Integration.exe 和 SiebelAx_Desktop_Integration.inf。

有谁知道我是否可以在 perl 脚本中包含这些文件中的数据,以便我可以编写与上述代码等效的 perl 工作。我对 VBA 不太熟悉,不明白引擎盖下发生了什么?

【问题讨论】:

    标签: excel perl vba siebel


    【解决方案1】:

    我认为不可能 1 对 1.. 您将不得不重写代码以使其看起来像下面的示例:

    use feature 'say';
    use Siebel::COM::App::DataControl;
    use TryCatch;
    
    my $app = Siebel::COM::App::DataControl->new(
          {
              user       => 'sadmin',
              password   => 'sadmin',
              host       => 'test',
              enterprise => 'SIEBEL',
              lang       => 'ENU',
              aom        => 'eClinicalObjMgr_enu'
    
          }
    );
    
    my $created_by = '0-1';
    try {
        $app->login();
    
        my $bo = $app->get_bus_object('Account');
        my $bc = $bo->get_bus_comp('Account');
    
        $bc->activate_field('Location');
        $bc->activate_field('Extension Phone Number');
    
        $bc->clear_query();
        $bc->set_view_mode();
    
        $bc->set_search_spec( 'Created By', "='$created_by'" );
        $bc->query();
    
        if ( $bc->first_record() ) {
            do {
                my $val = $bc->get_field_value('Location');
                say $val;
            } while ( $bc->next_record() )
        } else {
            say 'Could not find the account';
        }
    } catch {
        die 'Exception: ' . $app->get_last_error();
    }
    

    神奇的是Siebel::COM perl 模块。 如果您发布 Excel 脚本的示例,我可能会帮助您将其更改为 Perl 等价物。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-12-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多