Help for this page

Select Code to Download


  1. or download this
    # use Constants
    use constant EXCEL => 'Excel.Application';
    use constant WORD => 'Word.Application';
    
    my $excel = Win32::OLE->GetActiveObject(&WORD)
    
  2. or download this
    #Use another package
    package MSApps;
    ...
    ## Then
    use MSApps;
    my $excel = Win32::OLE->GetActiveObject($MSApps::EXCEL)
    
  3. or download this
    #Do the most simple thing: create variables.
    my $EXCEL = 'Excel.Application';
    my $WORD = 'Word.Application';
    
    my $excel = Win32::OLE->GetActiveObject($WORD)