Excel automation

Hello,
I am trying to use the ActiveX Excel Automation server.  I have gotten TestStand to run the excel application, however, when I try to create a new workbook I get the following error:
"Create New Object" in automation call failed.
Class not registered
One possible reason for this error is that the server might be an in-process 64-bit COM server. TestStand is a 32-bit process and Windows does not allow a mixture of 32-bit and 64-bit code within the same process. TestStand can create objects from an out-of-process 64-bit COM server directly, but for in-process 64-bit COM servers you must create the object in an external 64-bit process and pass it into TestStand using an out-of-process server or a DLLSurrogate.
I have attached the sequence file I have been using.
Solved!
Go to Solution.
Attachments:
Excel Test.seq ‏6 KB

Hello mcooblal,
I took a look at your sequence file and you are not correctly accessing the workbook class. First you need to get a reference to the workbooks property which returns a reference to the workbooks property. Then using the workbooks reference you can then get the workbooks class which has a method for adding workbooks.
Here is a good sequence example that references these steps:
http://zone.ni.com/devzone/cda/epd/p/id/5318
Ian M.
National Instruments

Similar Messages

  • Excel Automation Closing

    Hello,
    I have developed a VI (based on ActiveX) that writes to a spreadsheet with some formatting. Past posts on this forum were very helpful in getting me at this point and Kudos to members who have posted VIs, LLBs, and created a thread just for Excel automation.
    I've one question related to Excel application closing:
    Currently, I am doing a clean close of all references in my VI for report generation using ActiveX. If I am viewing any open workbooks in excel when my VI is running then it closes all open xls/xlsx files when the "Excel Automation Close" is executed.
    My question is: Is it possible to somehow not close instance of Excel application that was not created/opened through LabVIEW?
    Thanks.

    Hello,
    Using the System Exec VI, I am able to get the Process ID of Excel application instance. However, to use the workbook node, Application refnum is required.
    Is there a way to get to the Application refnum using the process ID?
    For now, I have figured out a way to avoid any Excel workbook closing with Automation close. Wiring True to Open New Instance in Open Automation seems to do the trick.
    Thanks.

  • Excel Automation in C# - Excel process won´t quit

    Hi there,
    I´m using Excel automation with C#. When closing Excel, the Excel.exe process still remains in the Task Manager. I´ve tried all the topics that can be found, but Excel won´t quit. When I make Excel visible and close it myself, then the process will stop.
    But when I call the Quit() method, it keeps running.
    Here is my code:
    Excel.Application oExcel = new Excel.Application();
    oExcel.Visible = true;
    Excel.Workbooks oWorkbooks = oExcel.Workbooks;
    string Pfad = "C:\test.xlsx";
    Excel.Workbook oWorkbook = oWorkbooks.Open(Pfad);
    Excel.Worksheet oSheet = oWorkbook.Sheets[1];
    oSheet.Cells[1, 1] = "Test";
    oSheet.SaveAs("C:\test.xlsx");
    GC.Collect();
    GC.WaitForPendingFinalizers();
    Marshal.FinalReleaseComObject(oSheet);
    oWorkbook.Close();
    Marshal.FinalReleaseComObject(oWorkbook);
    oExcel.Workbooks.Close();
    Marshal.FinalReleaseComObject(oWorkbooks);
    oExcel.Application.Quit();
    Marshal.FinalReleaseComObject(oExcel);
    oExcel = null;
    Thanks for any help!

    Sorry I didn't catch the problem sooner.  No need to do any of the marshal stuff or the releases.  they are not necessary.  when you modify the workbook excel won't normally close without the user being prompted if they want to save changes. 
    So simply end you code like this
    If you don't want to save changes
    boolean savechanges = false;
    oWorkbook.Close(savechanges, Type.Missing, Type.Missing);
                    oWorkbook = null;
                    oExcel.Quit();                
                    oExcel
    = null;
    Or this if yo do want to save changes
    boolean savechanges = true;
    oWorkbook.Close(savechanges, Type.Missing, Type.Missing);
                    oWorkbook = null;
                    oExcel.Quit();                
                    oExcel
    = null;
    jdweng

  • Excel Automation with Interop - Windows Service - Microsoft Excel cannot access the file

    I have a windows console application, which automates Excel. In our scenario the application gets called from a Windows Service. If the console app is executed directly everything works fine. If the console app is executed through the Win Service, we get
    the following error when trying to open the excel file:
    Unhandled exception Occured : 'Microsoft Excel cannot access the file 'bla.xls'. There are several possible reasons:
    The file name or path does not exist.
    The file is being used by another program.
    The workbook you are trying to save has the same name as a currently open workbook.'.'
    The code snippet used to open the file:
    xlApp = new Application();xlApp.Visible = false;xlApp.UserControl = false;xlApp.Application.ScreenUpdating = false;xlApp.DisplayAlerts = false;xlWorkbook = xlApp.Workbooks.Open( Filename: filePath,  UpdateLinks: 2,  IgnoreReadOnlyRecommended: true, Editable: false);
    The console app and windows service are running on a Win Server 2008 64-bit OS with Excel 2013 32-bit installed. The service is running with a special user account, which has all the right permissions on accessed files and folders. The excel process is also
    started with the same account (I cheched that one). 
    I already tried to do the following, but to no avail:
    Run excel.exe /automation -> worked fine
    Created the folders and also gave full control to the account under which the service is run (even gave full control to Everyone)
    C:\Windows\SysWOW64\config\systemprofile\Desktop
    C:\Windows\System32\config\systemprofile\Desktop
    Configured DCOM
    Excel Application -> Identity -> Specific user account
    Excel Application -> Identity -> Interactive User
    Excel Application -> Security -> Launch permissions -> Everyone full control
    Several combinations of the above
    So I really am stuck with this problem right now. Any input on this is appreciated.

    I have a windows console application, which automates Excel. In our scenario the application gets called from a Windows Service. If the console app is executed directly everything works fine. If the console app is executed through the Win Service, we get
    the following error when trying to open the excel file
    Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office
    may exhibit unstable behavior and/or deadlock when Office is run in this environment.
    If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side.
    If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.
    You can read more about that in the
    Considerations for server-side Automation of Office article.

  • Extract text from PDF and parse to Excel, automator? applescript?

    I'd been trying to do this with automator and have been getting nowhere. 
    I have some pdf files that have selectable, formatted text in them.
    Its an old college directory that I would like to import.  There are chunks of text:
    Name:  XXX, XXX
    Telephone: (XXX) XXX-XXXX        DOB:    XX/XX/XX          Gender: XXX
    Hometown:
    dflasdkfjdlkj
    asdflajksdflj
    adsflakjdsf
    Name:  XXX, XXX
    Telephone: (XXX) XXX-XXXX        DOB:    XX/XX/XX          Gender: XXX
    Hometown:
    dflasdkfjdlkj
    asdflajksdflj
    adsflakjdsf
    Name:  XXX, XXX
    Telephone: (XXX) XXX-XXXX        DOB:    XX/XX/XX          Gender: XXX
    Hometown:
    dflasdkfjdlkj
    asdflajksdflj
    adsflakjdsf
    etc.
    I'd like to find a way to extract the names, the phone numbers, and the hometowns and get it all into those respective columns in excel.  Seems that I don't stand a chance with automator.  Do I need a programmer for this?

    I'd been trying to do this with automator and have been getting nowhere. 
    I have some pdf files that have selectable, formatted text in them.
    Its an old college directory that I would like to import.  There are chunks of text:
    Name:  XXX, XXX
    Telephone: (XXX) XXX-XXXX        DOB:    XX/XX/XX          Gender: XXX
    Hometown:
    dflasdkfjdlkj
    asdflajksdflj
    adsflakjdsf
    Name:  XXX, XXX
    Telephone: (XXX) XXX-XXXX        DOB:    XX/XX/XX          Gender: XXX
    Hometown:
    dflasdkfjdlkj
    asdflajksdflj
    adsflakjdsf
    Name:  XXX, XXX
    Telephone: (XXX) XXX-XXXX        DOB:    XX/XX/XX          Gender: XXX
    Hometown:
    dflasdkfjdlkj
    asdflajksdflj
    adsflakjdsf
    etc.
    I'd like to find a way to extract the names, the phone numbers, and the hometowns and get it all into those respective columns in excel.  Seems that I don't stand a chance with automator.  Do I need a programmer for this?

  • Problem with Excel automation refnum

    While presenting ActiveX functions to students, I ran into an unexpected problem : only half of the PCs were able to work with Excel after the initial basic steps :
    place an automation refnum on the front panel
    right-click the automation refnum, then select ActiveX class, then select browse
    find Microsoft Excel objects library and select application
    connect an Automation open function
    etc...
    What happened is that an error 3005 (Automation Open: Object specified is not creatable in ... ) was generated on half the machines, while everything was running smoothly on the others.
    A workaround was to grab a working automation refnum control from the examples shipped with LabVIEW. The icon appears different and has a black arrow instead of the purple one got from the refnums palette. But even with this refnum, the problem could be reproduced when the activeX class was changed forth and back !
    All the systems (Windows XP- LV 8.2) and machines were identical, configured initially from the same disk image.
    Do you an idea of what's going on there ? Do you know where I  can get the black-arrowed automation refnum ?
    Message Edité par chilly charly le 12-08-2006 05:32 AM
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    Example_BD.png ‏3 KB

    Bump...
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • Excel automation refnum

    Hi all
    sorry for this stupid answer, but i'm just beginner in LabVIEW...
    I need to open and then to use  data from excel file in my calculus
    I read that it possible with automation refnum, but I can't do it
    Anybody could show me example how I can connect my excel file with automation refnum?
    Attachments:
    Testo.xls ‏8 KB

    hi citra,
    Actually I dont know your requirement.... But try this...
    Try 1
    Try2
    <<Kudos are welcome>>
    ELECTRO SAM
    For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life.
    - John 3:16

  • Activex Excel Automation: the Missing Handle

    Once upon a time there was a piece of legacy code, working well.  It would open Excel workbooks, add data, and make it look nice.
    Then one fateful day, the old code creaked and groaned, and it doesn't work the same way it used to when it was fresher and younger.
    Now when the code runs, an excel 2007 reference is not closed somewhere, causing the excel.exe process to remain open after the code has finished execution.
    With great care, I have extracted all the extraneous code from the process, so that only a few base functions remain; yet the problem persists!  For your convenience, I have flattened it all onto the same vi pane (the old code is rather modular)!  Apologies for any extraneous wire bends =)
    My questions are threefold:
    What changed that caused this code to stop working? 
    Is there a better way to find and close activex references than staring intently at the wires?
    Is there, dear reader, perhaps a blatent error in the old code?
    Attachments:
    Fun with references.png ‏59 KB

    I"ve moved all the CR's to the end of the VI.  The problem persists.  Look at the examples? Are you toying with me?
    Attachments:
    test.vi ‏16 KB

  • IDCS2 How to make excel automation in Indesign Javascripting?

    Hi all,
    I have an excel sheet with several columns.I need to replace one of the column in the excel sheet with another set of values using (Indesign)javascript.
    Please help.
    Provide me with code snippets.
    Regards
    amu

    >in the excel sheet [...] using (Indesign)javascript
    It seems to me you think that javascript ("InDesign" JS??) can control any application on your computer.
    Not so.
    InDesign has 'generic' support for external programming languages. It can be controlled using JavaScript, Visual Basic for Applications (on Windows), AppleScript (on the Mac), and COM-aware programs, such as C++. The support for this is built-in into InDesign.
    Excel has built-in support for Visual Basic. This probably means you can steer both Excel and ID from within the same VB -- I know it's possible through Word -- but has nothing to do with JS. Or with InDesign's support for JS. Or InDesign Scripting in general.
    So, is it possible with VB? Well, it might be, but you might want to ask that one on a Microsoft forum, or this one:
    >Provide me with code snippets.
    (snip)

  • Admiright Problem with Tdms Excel Automation

    Hi
    i have a problem with the TDMS Excel Plugin. I normally have now Administrator Rights on my Computer. So i got the Administator Rights to install the TDMS Excel Plugin. After i had the rights, i installed the Plugin and everything works fine. Then i wrote a VBA script with automatically imports TDMS Files and Copy &Paste Values in a new Excel sheet. Thes macro also works fine. After a while i lost my Admin Rights and i am a "Normal" user again. But with no more Admin-rights my macro doesn't work any longer. There is a error messange which tells me that " ...only a Administator can connect or disconnect the Plugin..."
    The normal manual import with the Plugin still works.
    Can anybody help me with this probblem?
    Thanks

    Bump...
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • Open an Excel file to read and load it into Oracle - Oracle COM Automation

    Hello All,
    Please I need your help for this problem:
    I need to load Excel sheet data (read the data) and load it into Oracle database (insert into a table), the excel file created and has data before, and saved with xls format. and I need to do that using the Oracle® COM Automation (ordcom package). The examples I found open and create a new workbook and deletes the old saved data, so I need to open (edit) the sheet just for reading.
    I appreciate ans sample code to help me do that, Please help me out. This is very urgent.
    Thanks alot and best regards,
    Nabil

    For reading from Excel, there are some easy ways like Oracle Heterogenious Services. If you want to use COM then:
    My orawpcom.dll file exists in the directory C:\oracle\product\10.2.0\db_2\bin
    C:\oracle\product\10.2.0\db_2\bin>dir orawpco*.dll
    Volume in drive C is C_Drive
    Volume Serial Number is 8A93-1441
    Directory of C:\oracle\product\10.2.0\db_2\bin
    03/20/2006  05:06 PM            61,440 orawpcom.dll
    10/11/2006  03:20 PM            81,920 orawpcom10.dll
                   2 File(s)        143,360 bytes
                   0 Dir(s)  65,407,717,376 bytes free
    C:\oracle\product\10.2.0\db_2\bin>Information about my database version.
    SQL> /* My databaser version */
    SQL> SELECT * FROM v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    SQL> Preparing the user SCOTT for COM automation.
    Now, I will run comwrap.sql from scott user. I have edited the comwrap.sql to adjust my library path here:
    create library utils_lib as 'C:\oracle\product\10.2.0\db_3\bin\orawpcom.dll';Running comwrap.sql and ExcelSolution.sql .....
    SQL> conn scott@orclsb
    Enter password: *****
    Connected.
    SQL> @c:\comwrap.sql
    drop library utils_lib
    ERROR at line 1:
    ORA-04043: object UTILS_LIB does not exist
    Library created.
    drop package ORDCOM
    ERROR at line 1:
    ORA-04043: object ORDCOM does not exist
    drop TYPE OAArgTable
    ERROR at line 1:
    ORA-04043: object OAARGTABLE does not exist
    Type created.
    drop TYPE OAArgTypeTable
    ERROR at line 1:
    ORA-04043: object OAARGTYPETABLE does not exist
    Type created.
    drop function OAgetNumber
    ERROR at line 1:
    ORA-04043: object OAGETNUMBER does not exist
    Function created.
    drop function OAgetStr
    ERROR at line 1:
    ORA-04043: object OAGETSTR does not exist
    Function created.
    drop function OAgetBool
    ERROR at line 1:
    ORA-04043: object OAGETBOOL does not exist
    Function created.
    drop function OAsetNumber
    ERROR at line 1:
    ORA-04043: object OASETNUMBER does not exist
    Function created.
    drop function OAsetString
    ERROR at line 1:
    ORA-04043: object OASETSTRING does not exist
    Function created.
    drop function OAsetBoolean
    ERROR at line 1:
    ORA-04043: object OASETBOOLEAN does not exist
    Function created.
    drop function OAInvokeDouble
    ERROR at line 1:
    ORA-04043: object OAINVOKEDOUBLE does not exist
    Function created.
    drop function OAInvokeBoolean
    ERROR at line 1:
    ORA-04043: object OAINVOKEBOOLEAN does not exist
    Function created.
    drop function OAInvokeString
    ERROR at line 1:
    ORA-04043: object OAINVOKESTRING does not exist
    Function created.
    drop function OACreate
    ERROR at line 1:
    ORA-04043: object OACREATE does not exist
    Function created.
    drop function OADestroy
    ERROR at line 1:
    ORA-04043: object OADESTROY does not exist
    Function created.
    drop function OAGetLastError
    ERROR at line 1:
    ORA-04043: object OAGETLASTERROR does not exist
    Function created.
    drop function OAQueryMethods
    ERROR at line 1:
    ORA-04043: object OAQUERYMETHODS does not exist
    Function created.
    Package created.
    Package body created.
    SQL>
    SQL> @c:\ExcelSolution.sql
    drop package ORDExcel
    ERROR at line 1:
    ORA-04043: object ORDEXCEL does not exist
    Package created.
    Package body created.
    SQL>
    I have modified ORDExcel a little bit and renamed it as ORDExcelSB. You need this version for reading the excel.
    SQL> @C:\ExcelSolutionSB.sql
    Package dropped.
    Package created.
    Package body created.
    SQL> The actual code of ORDExcelSB (ExcelSolutionSB.sql) Is:
    set serveroutput on;
    drop package ORDExcelSB;
    CREATE PACKAGE ORDExcelSB AS
       /* Declare externally callable subprograms. */
       FUNCTION CreateExcelApplication(servername VARCHAR2) RETURN binary_integer;
       FUNCTION OpenExcelFile(filename VARCHAR2, sheetname VARCHAR2) RETURN binary_integer;
       FUNCTION CreateExcelWorkSheet(servername varchar2) return binary_integer;
       FUNCTION InsertData(range varchar2, data binary_integer, type varchar2) return binary_integer;
       FUNCTION InsertDataReal(range varchar2, data double precision, type varchar2) return binary_integer;
       FUNCTION GetDataNum(range varchar2) return binary_integer;
       FUNCTION GetDataStr(range varchar2) return varchar2;
       FUNCTION GetDataReal(range varchar2) return double precision;
       FUNCTION GetDataDate(range varchar2) return date;
       FUNCTION InsertData(range varchar2, data varchar2, type varchar2) return binary_integer;
       FUNCTION InsertData(range varchar2, data Date, type varchar2) return binary_integer;
       FUNCTION InsertChart(xpos binary_integer, ypos binary_integer, width binary_integer,
                                  height binary_integer, range varchar2, type varchar2) return binary_integer;
       FUNCTION SaveExcelFile(filename varchar2) return binary_integer;
       FUNCTION ExitExcel return binary_integer;
    END ORDExcelSB;
    CREATE PACKAGE BODY ORDExcelSB AS
       DummyToken          binary_integer;     
       applicationToken binary_integer:=-1;
       WorkBooksToken     binary_integer:=-1;
       WorkBookToken     binary_integer:=-1;
       WorkSheetToken     binary_integer:=-1;
       WorkSheetToken1     binary_integer:=-1;
       RangeToken          binary_integer:=-1;
       ChartObjectToken     binary_integer:=-1;
       ChartObject1          binary_integer:=-1;
       Chart1Token          binary_integer:=-1;
       i                    binary_integer;
       retNum               binary_integer;
       retReal               double precision;
       retStr               varchar2(255);
       retDate               DATE;
    error_src varchar2(255);
    error_description varchar2(255);
    error_helpfile varchar2(255);
    error_helpID binary_integer;
    FUNCTION CreateExcelApplication(servername VARCHAR2) RETURN binary_integer IS
      BEGIN
        dbms_output.put_line('Creating Excel application...');
        i := OrdCOM.CreateObject('Excel.Application',
                                 0,
                                 servername,
                                 applicationToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        dbms_output.put_line('Invoking Workbooks...');
        i := ORDCOM.GetProperty(applicationToken,
                                'WorkBooks',
                                0,
                                WorkBooksToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        RETURN i;
      END CreateExcelApplication;
      FUNCTION OpenExcelFile(filename VARCHAR2, sheetname VARCHAR2)
        RETURN binary_integer IS
      BEGIN
        dbms_output.put_line('Opening Excel file ' || filename || ' ...');
        ORDCOM.InitArg();
        ORDCOM.SetArg(filename, 'BSTR');
        i := ORDCOM.Invoke(WorkBooksToken, 'Open', 1, DummyToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        dbms_output.put_line('Opening WorkBook');
        i := ORDCOM.GetProperty(applicationToken,
                                'ActiveWorkbook',
                                0,
                                WorkBookToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        dbms_output.put_line('Invoking WorkSheets..');
        i := ORDCOM.GetProperty(applicationToken,
                                'WorkSheets',
                                0,
                                WorkSheetToken1);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        dbms_output.put_line('Invoking WorkSheet');
        ORDCOM.InitArg();
        ORDCOM.SetArg(sheetname, 'BSTR');
        i := ORDCOM.GetProperty(WorkBookToken, 'Sheets', 1, WorkSheetToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        dbms_output.put_line('Opened ');
        RETURN i;
      END OpenExcelFile;
    * Invoke the Excel Automation Server and create a Workbook object as
    * well as a worksheet object
    FUNCTION CreateExcelWorkSheet(servername varchar2) return binary_integer IS
    BEGIN
         dbms_output.put_line('Creating Excel application...');
         i:=ORDCOM.CreateObject('Excel.Application', 0, servername,applicationToken);
         IF (i!=0) THEN
         ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
         dbms_output.put_line(error_src);
         dbms_output.put_line(error_description);
         dbms_output.put_line(error_helpfile);
         END IF;
         dbms_output.put_line('Invoking Workbooks...');
         /*i:=ORDCOM.Invoke(applicationToken, 'WorkBooks',0, WorkBooksToken);*/
         i:=ORDCOM.GetProperty(applicationToken, 'WorkBooks', 0, WorkBooksToken);
         IF (i!=0) THEN
         ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
         dbms_output.put_line(error_src);
         dbms_output.put_line(error_description);
         dbms_output.put_line(error_helpfile);
         END IF;
         dbms_output.put_line('Invoking Add to WorkBooks...');
         ORDCOM.InitArg();
         ORDCOM.SetArg(-4167,'I4');
         i:=ORDCOM.Invoke(WorkBooksToken, 'Add', 1, WorkBookToken);
    IF (i!=0) THEN
         ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
         dbms_output.put_line(error_src);
         dbms_output.put_line(error_description);
         dbms_output.put_line(error_helpfile);
         END IF;
         dbms_output.put_line('Invoking WorkSheets..');
         ORDCOM.InitArg();
         ORDCOM.SetArg('Sheet 1','BSTR');
    /*     i:=ORDCOM.Invoke(applicationToken, 'WorkSheets', 1, WorkSheetToken);*/
    i:=ORDCOM.GetProperty(applicationToken, 'WorkSheets', 0, WorkSheetToken1);
    IF (i!=0) THEN
         ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
         dbms_output.put_line(error_src);
         dbms_output.put_line(error_description);
         dbms_output.put_line(error_helpfile);
         END IF;
    i:=ORDCOM.Invoke(WorkSheetToken1, 'Add', 0, WorkSheetToken);
    IF (i!=0) THEN
         ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
         dbms_output.put_line(error_src);
         dbms_output.put_line(error_description);
         dbms_output.put_line(error_helpfile);
         END IF;
         return i;
    END CreateExcelWorkSheet;
    * Invoke the Range method to obtain a range token. Then set the property value
    * at the specified range to the data required
    FUNCTION InsertData( range varchar2,
                             data binary_integer,
                             type varchar2)
                             RETURN binary_integer IS
    BEGIN
         ORDCOM.InitArg();
         ORDCOM.SetArg(range, 'BSTR');
         i:=ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
         IF (i!=0) THEN
         ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
         dbms_output.put_line(error_src);
         dbms_output.put_line(error_description);
         dbms_output.put_line(error_helpfile);
         END IF;
         i:=ORDCOM.SetProperty(RangeToken, 'Value', data, type);
         IF (i=0) THEN
               i:=ORDCOM.SetProperty(RangeToken, 'ColumnWidth', 15, 'I2');
         END IF;
         i:=ORDCOM.DestroyObject(RangeToken);
         RETURN i;
    END InsertData;
    * Invoke the Range method to obtain a range token. Then set the property value
    * at the specified range to the data required
    FUNCTION GetDataNum( range varchar2)
                             RETURN binary_integer IS
    BEGIN
         ORDCOM.InitArg();
         ORDCOM.SetArg(range, 'BSTR');
         i:=ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
         IF (i!=0) THEN
         ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
         dbms_output.put_line(error_src);
         dbms_output.put_line(error_description);
         dbms_output.put_line(error_helpfile);
         END IF;
         i:=ORDCOM.GetProperty(RangeToken, 'Value', 0, retNum);
         IF (i!=0) THEN
         ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
         dbms_output.put_line(error_src);
         dbms_output.put_line(error_description);
         dbms_output.put_line(error_helpfile);
         END IF;
         i:=ORDCOM.DestroyObject(RangeToken);
         RETURN retNum;
    END GetDataNum;
    FUNCTION GetDataReal( range varchar2)
                             RETURN double precision IS
    BEGIN
         ORDCOM.InitArg();
         ORDCOM.SetArg(range, 'BSTR');
         i:=ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
         IF (i!=0) THEN
         ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
         dbms_output.put_line(error_src);
         dbms_output.put_line(error_description);
         dbms_output.put_line(error_helpfile);
         END IF;
         i:=ORDCOM.GetProperty(RangeToken, 'Value', 0, retReal);
         IF (i!=0) THEN
         ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
         dbms_output.put_line(error_src);
         dbms_output.put_line(error_description);
         dbms_output.put_line(error_helpfile);
         END IF;
         i:=ORDCOM.DestroyObject(RangeToken);
         RETURN retReal;
    END GetDataReal;
    FUNCTION GetDataStr( range varchar2)
                             RETURN varchar2 IS
    BEGIN
         ORDCOM.InitArg();
         ORDCOM.SetArg(range, 'BSTR');
         i:=ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
         IF (i!=0) THEN
         ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
         dbms_output.put_line(error_src);
         dbms_output.put_line(error_description);
         dbms_output.put_line(error_helpfile);
         END IF;
         i:=ORDCOM.GetProperty(RangeToken, 'Value', 0, retStr);
         IF (i!=0) THEN
         ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
         dbms_output.put_line(error_src);
         dbms_output.put_line(error_description);
         dbms_output.put_line(error_helpfile);
         END IF;
         i:=ORDCOM.DestroyObject(RangeToken);
         RETURN retStr;
    END GetDataStr;
    FUNCTION GetDataDate( range varchar2)
                             RETURN Date IS
    BEGIN
         ORDCOM.InitArg();
         ORDCOM.SetArg(range, 'BSTR');
         i:=ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
         IF (i!=0) THEN
         ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
         dbms_output.put_line(error_src);
         dbms_output.put_line(error_description);
         dbms_output.put_line(error_helpfile);
         END IF;
         i:=ORDCOM.GetProperty(RangeToken, 'Value', 0, retDate);
         IF (i!=0) THEN
         ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
         dbms_output.put_line(error_src);
         dbms_output.put_line(error_description);
         dbms_output.put_line(error_helpfile);
         END IF;
         i:=ORDCOM.DestroyObject(RangeToken);
         RETURN retDate;
    END GetDataDate;
    FUNCTION InsertData( range varchar2,
                             data DATE,
                             type varchar2)
                             RETURN binary_integer IS
    BEGIN
         ORDCOM.InitArg();
         ORDCOM.SetArg(range, 'BSTR');
         i:=ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
         i:=ORDCOM.SetProperty(RangeToken, 'Value', data, type);
         i:=ORDCOM.DestroyObject(RangeToken);
         RETURN i;
    END InsertData;
    FUNCTION InsertDataReal( range varchar2,
                             data double precision,
                             type varchar2)
                             RETURN binary_integer IS
    BEGIN
         ORDCOM.InitArg();
         ORDCOM.SetArg(range, 'BSTR');
         i:=ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
         i:=ORDCOM.SetProperty(RangeToken, 'Value', data, type);
         i:=ORDCOM.DestroyObject(RangeToken);
         RETURN i;
    END InsertDataReal;
    FUNCTION InsertData( range varchar2,
                             data varchar2,
                             type varchar2)
                             RETURN binary_integer IS
    BEGIN
         ORDCOM.InitArg();
         ORDCOM.SetArg(range, 'BSTR');
         i:=ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
         i:=ORDCOM.SetProperty(RangeToken, 'Value', data, type);
         i:=ORDCOM.DestroyObject(RangeToken);
         RETURN i;
    END InsertData;
    * Insert a chart at the x and y position of the spreadsheet with the desired
    * height and width. Then also uses the ChartWizard to draw the graph with data
    * in a specified range area with a specified charting type.
    FUNCTION InsertChart(xpos binary_integer, ypos binary_integer,
                              width binary_integer, height binary_integer,
                              range varchar2, type varchar2) RETURN binary_integer IS
         charttype binary_integer:= -4099;
    BEGIN
         ORDCOM.InitArg();
         i:=ORDCOM.GetProperty(WorkSheetToken, 'ChartObjects', 0, ChartObjectToken);
         IF (i!=0) THEN
         ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
         dbms_output.put_line(error_src);
         dbms_output.put_line(error_description);
         dbms_output.put_line(error_helpfile);
         END IF;
         ORDCOM.InitArg();
         ORDCOM.SetArg(xpos,'I2');
         ORDCOM.SetArg(ypos,'I2');
         ORDCOM.SetArg(width,'I2');
         ORDCOM.SetArg(height,'I2');
         i:=ORDCOM.Invoke(ChartObjectToken, 'Add', 4, ChartObject1);
         IF (i!=0) THEN
         ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
         dbms_output.put_line(error_src);
         dbms_output.put_line(error_description);
         dbms_output.put_line(error_helpfile);
         END IF;
         i:=ORDCOM.GetProperty(ChartObject1, 'Chart', 0,Chart1Token);
         ORDCOM.InitArg();
         ORDCOM.SetArg(range, 'BSTR');
         i:=ORDCOM.GetProperty(WorkSheetToken,'Range', 1, RangeToken);
         ORDCOM.InitArg();
         ORDCOM.SetArg(RangeToken, 'DISPATCH');
         IF type='xlPie' THEN
              charttype := -4102;
         ELSIF type='xl3DBar' THEN
              charttype := -4099;
         ELSIF type='xlBar' THEN
              charttype := 2;
         ELSIF type='xl3dLine' THEN
              charttype:= -4101;
         END IF;
         ORDCOM.SetArg(charttype,'I4');
         i:=ORDCOM.Invoke(Chart1Token,'ChartWizard', 2, DummyToken);
         i:=ORDCOM.DestroyObject(RangeToken);
         i:=ORDCOM.DestroyObject(ChartObjectToken);
         i:=ORDCOM.DestroyObject(ChartObject1);
         i:=ORDCOM.DestroyObject(Chart1Token);
         RETURN i;
    END InsertChart;
    * Save the Excel File. WARNING: Do not specify a filename that already exist
    * since there is no graphical context, Oracle would not be able to pop
    * out a warning message for existing file. This causes Excel to hang
    FUNCTION SaveExcelFile(filename varchar2) return binary_integer IS
    BEGIN
         dbms_output.put_line('Saving Excel file...');
         ORDCOM.InitArg();
         ORDCOM.SetArg(filename,'BSTR');
         i:=ORDCOM.Invoke(WorkBookToken, 'SaveAs', 1, DummyToken);
         IF (i!=0) THEN
         ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
         dbms_output.put_line(error_src);
         dbms_output.put_line(error_description);
         dbms_output.put_line(error_helpfile);
         END IF;
         RETURN i;     
    END SaveExcelFile;
    * Close the Excel spreadsheet and exit from it
    FUNCTION ExitExcel return binary_integer is
    BEGIN
         dbms_output.put_line('Closing workbook and quitting...');
         ORDCOM.InitArg();
         ORDCOM.InitArg();
         ORDCOM.SetArg(FALSE,'BOOL');
         dbms_output.put_line('Closing workbook...');
         i:=ORDCOM.Invoke(WorkBookToken, 'Close', 0, DummyToken);
         IF (i!=0) THEN
         ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
         dbms_output.put_line(error_src);
         dbms_output.put_line(error_description);
         dbms_output.put_line(error_helpfile);
         END IF;
         i:=ORDCOM.DestroyObject(WorkBookToken);     
         ORDCOM.InitArg();
         dbms_output.put_line('Closing workbooks...');
         i:=ORDCOM.Invoke(WorkBooksToken, 'Close', 0, DummyToken);
         IF (i!=0) THEN
         ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
         dbms_output.put_line(error_src);
         dbms_output.put_line(error_description);
         dbms_output.put_line(error_helpfile);
         END IF;
         i:=ORDCOM.DestroyObject(WorkBooksToken);
         i:=ORDCOM.Invoke(applicationToken, 'Quit', 0, DummyToken);
         IF (i!=0) THEN
         ORDCOM.GetLastError(error_src, error_description, error_helpfile, error_helpID);
         dbms_output.put_line(error_src);
         dbms_output.put_line(error_description);
         dbms_output.put_line(error_helpfile);
         END IF;
         i:=ORDCOM.DestroyObject(WorkSheetToken);     
         i:=ORDCOM.DestroyObject(WorkSheetToken1);     
         i:=ORDCOM.DestroyObject(applicationToken);
         i:=ORDCOM.DestroyObject(ChartObjectToken);
         i:=ORDCOM.DestroyObject(Chart1Token);
         i:=ORDCOM.DestroyObject(ChartObject1);
         i:=ORDCOM.DestroyObject(dummyToken);
         RETURN i;
    END ExitExcel;
    END ORDExcelSB;
    /I have created an excel named as C:\Example.xls.
    Name     SlNo     Job     Dept     Salary     Bonus
    Saubhik Banerjee     706090     IT Specialist     GBS     100     10
    Partha S Mohanty     706091     Pogrmmer     APPS     70     20
    Partha Sarkar     889300     Condultant     FIN     200     30
    Useless     98009     PM     PM     900     90
    SQL> SET SERVEROUT ON
    SQL> DECLARE
      2 
      3    v_Name          varchar2(90);
      4    v_SlNo          varchar2(100);
      5    v_Job           varchar2(200);
      6    v_Dept          varchar2(100);
      7    v_recon_remark  varchar2(50);
      8    v_sal_amt_usd   number;
      9    v_Bonus_amt_usd number;
    10 
    11    result INTEGER;
    12 
    13    i        binary_integer;
    14    filename varchar2(255);
    15 
    16  BEGIN
    17 
    18    filename := 'C:\Example.xls';
    19 
    20    result := ORDExcelSB.CreateExcelApplication('');
    21    result := ORDExcelSB.OpenExcelFile(filename, 'Sheet1');
    22 
    23    /* Excluding the header row and reading the first 5 row */
    24    FOR n in 2 .. 5 LOOP
    25   
    26      v_Name          := ORDExcelSB.GetDataStr('A' || n);
    27      v_SlNo          := ORDExcelSB.GetDataReal('B' || n);
    28      v_Job           := ORDExcelSB.GetDataStr('C' || n);
    29      v_Dept          := ORDExcelSB.GetDataStr('D' || n);
    30      v_sal_amt_usd   := ORDExcelSB.GetDataNum('E' || n);
    31      v_Bonus_amt_usd := ORDExcelSB.GetDataNum('F' || n);
    32   
    33      dbms_output.put_line(v_Name || '  ' || v_SlNo || '  ' || v_Job || '  ' ||
    34                           v_Dept || '  ' || v_sal_amt_usd || '  ' ||
    35                           v_Bonus_amt_usd);
    36   
    37    END LOOP;
    38 
    39    result := ORDExcelSB.ExitExcel();
    40  EXCEPTION
    41    WHEN OTHERS THEN
    42      result := ORDExcelSB.ExitExcel();
    43      RAISE;
    44  END;
    45  /
    Creating Excel application...
    Invoking Workbooks...
    Opening Excel file C:\Example.xls ...
    Opening WorkBook
    Invoking WorkSheets..
    Invoking WorkSheet
    Opened
    Saubhik Banerjee  706090  IT Specialist  GBS  100  10
    Partha S Mohanty  706091  Pogrmmer  APPS  70  20
    Partha Sarkar  889300  Condultant  FIN  200  30
    Useless  98009  PM  PM  900  90
    Closing workbook and quitting...
    Closing workbook...
    Closing workbooks...
    PL/SQL procedure successfully completed.
    SQL> Although, You haven't asked, but you can use this code to write to excel file (.xls)
    DECLARE
    CURSOR c1 IS     
         SELECT empno, ename, dname, sal, hiredate
         FROM emp e, dept d
         WHERE e.deptno = d.deptno;
    error_message varchar2(1200);
    n binary_integer:=2;
    i binary_integer;
    filename varchar2(255);
    cellIndex varchar2(40);
    cellValue varchar2(40);
    cellColumn varchar2(10);
    returnedTime varchar2(20);
    currencyvalue double precision;
    datevalue DATE;
    empno binary_integer;
    looptext varchar2(20);
    error_src varchar2(255);
    error_description varchar2(255);
    error_helpfile varchar2(255);
    error_helpID binary_integer;
    begin
    filename:='c:\example2.xls';
    i:=ORDExcel.CreateExcelWorkSheet('');
    i:=ORDExcel.InsertData('A1', 'EmpNo', 'BSTR');
    i:=ORDExcel.InsertData('B1', 'Name', 'BSTR');
    i:=ORDExcel.InsertData('C1', 'Dept', 'BSTR');
    i:=ORDExcel.InsertData('D1', 'Salary', 'BSTR');
    i:=ORDExcel.InsertData('E1', 'HireDate', 'BSTR');
    For c1_rec IN c1 LOOP
    cellColumn:=TO_CHAR(n);
    cellIndex:=CONCAT('A',cellColumn);
    cellValue:=TO_CHAR(c1_rec.empno);
    empno:=cellValue;
    i:=ORDExcel.InsertData(cellIndex, empno, 'I2');
    cellIndex:=CONCAT('B',cellColumn);
    cellValue:=c1_rec.ename;
    i:=ORDExcel.InsertData(cellIndex, cellValue, 'BSTR');
    cellIndex:=CONCAT('C',cellColumn);
    cellValue:=c1_rec.dname;
    i:=ORDExcel.InsertData(cellIndex, cellValue, 'BSTR');
    cellIndex:=CONCAT('D',cellColumn);
    cellValue:=c1_rec.sal;
    currencyValue:=cellValue;
    i:=ORDExcel.InsertData(cellIndex, currencyValue, 'CY');
    cellIndex:=CONCAT('E',cellColumn);
    dateValue:=c1_rec.hiredate;
    i:=ORDExcel.InsertData(cellIndex, dateValue, 'DATE');
    n:=n+1;
    END LOOP;
    i:=ORDExcel.SaveExcelFile(filename);
    i:=ORDExcel.ExitExcel();
    EXCEPTION
    WHEN OTHERS THEN
      i:=ORDExcel.ExitExcel();
      RAISE;
    END;

  • Automating pdf printing in Excel

    Hi
    I've searched all over the Adobe website for some basic product information and failed completely. Hopefully, someone here will be able to help me.
    I'm looking to write some VBA code in Excel that will effectively do a mail merge and produce a number - about 300 - of tailored pdf files (or one large pdf file made up of a number of tailored documents). But I can't find out from the website whether this is possible with Acrobat and if it is, which version I would need.
    The main requirements are:
    * Printing to pdf controllable via VBA so that there is no user intervention - ie the filename can be set automatically in code without any nasty "sendkeys" type hack
    * Ability to append a number of documents into one pdf file
    Thanks for your help,
    A

    Ok, the reason for the question was licensing: different products
    needed. In this case, Acrobat Professional (perhaps Acrobat Standard)
    would fit the bill. As a developer with Acrobat you would want the
    Acrobat SDK, a vast collection of documentation on how to automate
    Acrobat, often missing all the things that people most want to do.
    You can
    * Use the Distiller API to bypass the filename prompt when printing to
    PDF. (This implies you use Excel automation to get as far as choosing
    the Adobe PDF printer, and "printing").
    * Use the Acrobat API to remote control Acrobat to open a PDF, and add
    pages from other PDFs, then finally save.
    Aandi Inston

  • Format Excel sheet - Oracle COM Automation

    Dear gentlemen,
    I would like to get your help to generate a formatted excel sheet using Oracle COM Automation, I may don’t know the correct properties to use, or don’t know how to use it.
    For example:
    To set a cell value I use this line:
    hresult:=Ordcom.SetProperty(RangeHandle, 'Value', data, 'BSTR');
    and when I tried to fill the same cell with a yello color I used this line:
    hresult:=Ordcom.SetProperty(RangeHandle, 'Interior.Color', 65535, 'BSTR');
    but that has no effect at all, so please advise what is wrong, this may apply also for the most properties such as “Font.Bold”.
    I appreciate so much any help from you.
    Best regards,
    Nabil

    Here is another version of my package ORDExcelSB. It includes almost all the formatting needs in Excel.
    Package Specification:_
    CREATE OR REPLACE PACKAGE ORDExcelSB AS
      /* Saubhik: These constants are added */
        BorderEdgeLeft CONSTANT BINARY_INTEGER:= 7;
        BorderEdgeTop CONSTANT BINARY_INTEGER:=8;
        BorderEdgeBottom CONSTANT BINARY_INTEGER:=9;
        BorderEdgeRight CONSTANT BINARY_INTEGER:=10;
        BorderInsideVertical CONSTANT BINARY_INTEGER:=11;
        BorderInsideHorizontal CONSTANT BINARY_INTEGER:=12;
      /* Declare externally callable subprograms. */
      /* Start: These functions are newly aded by Saubhik Banerjee */
      FUNCTION CreateExcelApplication(servername VARCHAR2) RETURN binary_integer;
      FUNCTION OpenExcelFile(filename VARCHAR2, sheetname VARCHAR2)
        RETURN binary_integer;
      FUNCTION SetCellColor(range varchar2, style INTEGER)
        return binary_integer;
      FUNCTION SetCellBorder(range varchar2, BordersIndex BINARY_INTEGER, BorderStyle BINARY_INTEGER)
        return binary_integer;   
      FUNCTION FormatFontStyle(range varchar2, fontstyle varchar2)
        return binary_integer;   
      FUNCTION FormatFontColor(range varchar2, fontcolor INTEGER)
        return binary_integer;   
      FUNCTION FormatFontName(range varchar2, fontname varchar2)
        return binary_integer;  
      FUNCTION FormatFontSize(range varchar2, fontsize INTEGER)
        return binary_integer ;  
      /* End: These functions are newly aded by Saubhik Banerjee */
      FUNCTION CreateExcelWorkSheet(servername varchar2) return binary_integer;
      FUNCTION InsertData(range varchar2, data binary_integer, type varchar2)
        return binary_integer;
      FUNCTION InsertDataReal(range varchar2,
                              data  double precision,
                              type  varchar2) return binary_integer;
      FUNCTION GetDataNum(range varchar2) return binary_integer;
      FUNCTION GetDataStr(range varchar2) return varchar2;
      FUNCTION GetDataReal(range varchar2) return double precision;
      FUNCTION GetDataDate(range varchar2) return date;
      FUNCTION InsertData(range varchar2, data varchar2, type varchar2)
        return binary_integer;
      FUNCTION InsertData(range varchar2, data Date, type varchar2)
        return binary_integer;
      FUNCTION InsertChart(xpos   binary_integer,
                           ypos   binary_integer,
                           width  binary_integer,
                           height binary_integer,
                           range  varchar2,
                           type   varchar2) return binary_integer;
      FUNCTION SaveExcelFile(filename varchar2) return binary_integer;
      FUNCTION ExitExcel return binary_integer;
    END ORDExcelSB;
    Package Body:_
    CREATE OR REPLACE PACKAGE BODY ORDExcelSB AS
      DummyToken        binary_integer;
      applicationToken  binary_integer := -1;
      WorkBooksToken    binary_integer := -1;
      WorkBookToken     binary_integer := -1;
      WorkSheetToken    binary_integer := -1;
      WorkSheetToken1   binary_integer := -1;
      RangeToken        binary_integer := -1;
      ChartObjectToken  binary_integer := -1;
      ChartObject1      binary_integer := -1;
      Chart1Token       binary_integer := -1;
      i                 binary_integer;
      retNum            binary_integer;
      retReal           double precision;
      retStr            varchar2(255);
      retDate           DATE;
      error_src         varchar2(255);
      error_description varchar2(255);
      error_helpfile    varchar2(255);
      error_helpID      binary_integer;
      FUNCTION CreateExcelApplication(servername VARCHAR2) RETURN binary_integer IS
      BEGIN
        dbms_output.put_line('Creating Excel application...');
        i := OrdCOM.CreateObject('Excel.Application',
                                 0,
                                 servername,
                                 applicationToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        dbms_output.put_line('Invoking Workbooks...');
        i := ORDCOM.GetProperty(applicationToken,
                                'WorkBooks',
                                0,
                                WorkBooksToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        RETURN i;
      END CreateExcelApplication;
      FUNCTION OpenExcelFile(filename VARCHAR2, sheetname VARCHAR2)
        RETURN binary_integer IS
      BEGIN
        dbms_output.put_line('Opening Excel file ' || filename || ' ...');
        ORDCOM.InitArg();
        ORDCOM.SetArg(filename, 'BSTR');
        i := ORDCOM.Invoke(WorkBooksToken, 'Open', 1, DummyToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        dbms_output.put_line('Opening WorkBook');
        i := ORDCOM.GetProperty(applicationToken,
                                'ActiveWorkbook',
                                0,
                                WorkBookToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        dbms_output.put_line('Invoking WorkSheets..');
        i := ORDCOM.GetProperty(applicationToken,
                                'WorkSheets',
                                0,
                                WorkSheetToken1);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        dbms_output.put_line('Invoking WorkSheet');
        ORDCOM.InitArg();
        ORDCOM.SetArg(sheetname, 'BSTR');
        i := ORDCOM.GetProperty(WorkBookToken, 'Sheets', 1, WorkSheetToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        dbms_output.put_line('Opened ');
        RETURN i;
      END OpenExcelFile;
      * Invoke the Excel Automation Server and create a Workbook object as
      * well as a worksheet object
      FUNCTION CreateExcelWorkSheet(servername varchar2) return binary_integer IS
      BEGIN
        dbms_output.put_line('Creating Excel application...');
        i := ORDCOM.CreateObject('Excel.Application',
                                 0,
                                 servername,
                                 applicationToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        dbms_output.put_line('Invoking Workbooks...');
        /*i:=ORDCOM.Invoke(applicationToken, 'WorkBooks',0, WorkBooksToken);*/
        i := ORDCOM.GetProperty(applicationToken,
                                'WorkBooks',
                                0,
                                WorkBooksToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        dbms_output.put_line('Invoking Add to WorkBooks...');
        ORDCOM.InitArg();
        ORDCOM.SetArg(-4167, 'I4');
        i := ORDCOM.Invoke(WorkBooksToken, 'Add', 1, WorkBookToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        dbms_output.put_line('Invoking WorkSheets..');
        ORDCOM.InitArg();
        ORDCOM.SetArg('Sheet 1', 'BSTR');
        /*  i:=ORDCOM.Invoke(applicationToken, 'WorkSheets', 1, WorkSheetToken);*/
        i := ORDCOM.GetProperty(applicationToken,
                                'WorkSheets',
                                0,
                                WorkSheetToken1);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        i := ORDCOM.Invoke(WorkSheetToken1, 'Add', 0, WorkSheetToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        return i;
      END CreateExcelWorkSheet;
      * Invoke the Range method to obtain a range token. Then set the property value
      * at the specified range to the data required
      FUNCTION InsertData(range varchar2, data binary_integer, type varchar2)
        RETURN binary_integer IS
      BEGIN
        ORDCOM.InitArg();
        ORDCOM.SetArg(range, 'BSTR');
        i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        i := ORDCOM.SetProperty(RangeToken, 'Value', data, type);
        IF (i = 0) THEN
          i := ORDCOM.SetProperty(RangeToken, 'ColumnWidth', 15, 'I2');
        END IF;
        i := ORDCOM.DestroyObject(RangeToken);
        RETURN i;
      END InsertData;
    /* Saubhik: This function is added to set the cell Border */
      FUNCTION SetCellBorder(range varchar2, BordersIndex BINARY_INTEGER, BorderStyle BINARY_INTEGER)
        return binary_integer IS
        --fontToken binary_integer;
        BorderToken BINARY_INTEGER;
       BEGIN
           ORDCOM.InitArg();
          ORDCOM.SetArg(range, 'BSTR');
          i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
          ORDCOM.InitArg();
          ORDCOM.SetArg(BordersIndex, 'I2');
          i := ORDCOM.GetProperty(RangeToken, 'Borders', 1, BorderToken);
          i := ORDCOM.SetProperty(BorderToken, 'weight', BorderStyle, 'I2');
          i := ORDCOM.DestroyObject(BorderToken);
          i := ORDCOM.DestroyObject(RangeToken);
          return i;
        END SetCellBorder; 
    /* Saubhik: This function is added to set the cell background color */
      FUNCTION SetCellColor(range varchar2, style INTEGER)
        return binary_integer IS
        --fontToken binary_integer;
        DummyToken BINARY_INTEGER;
        SelectionToken BINARY_INTEGER;
        InteriorToken BINARY_INTEGER;
        --applicationToken
          BEGIN
          ORDCOM.InitArg();
          ORDCOM.SetArg(range, 'BSTR');
          i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
          i := ORDCOM.Invoke(RangeToken,'SELECT',0,DummyToken);
          i := ORDCOM.GetProperty(applicationToken,'Selection',0,SelectionToken);
          i := ORDCOM.GetProperty(SelectionToken, 'Interior', 0, InteriorToken);
          i := ORDCOM.SetProperty(InteriorToken, 'ColorIndex', style, 'I2');
          i := ORDCOM.DestroyObject(RangeToken);
          return i;
        END SetCellColor;
    /* Saubhik: This function is added to change the font style like Bold, Italic etc. */
      FUNCTION FormatFontStyle(range varchar2, fontstyle varchar2)
        return binary_integer IS
        fontToken binary_integer;
          BEGIN
          ORDCOM.InitArg();
          ORDCOM.SetArg(range, 'BSTR');
          i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
          i := ORDCOM.GetProperty(RangeToken, 'Font', 0, FontToken);
          IF fontstyle = 'Bold' OR fontstyle = 'Italic' OR
             fontstyle = 'Underline' THEN
              i := ORDCOM.SetProperty(FontToken, fontstyle, True, 'BOOL');
          END IF;
          i := ORDCOM.DestroyObject(FontToken);
          i := ORDCOM.DestroyObject(RangeToken);
          return i;
        END FormatFontStyle;
    /* Saubhik: This function is added to change the font style like Arial, Bookman, Century etc. */
      FUNCTION FormatFontName(range varchar2, fontname varchar2)
        return binary_integer IS
        fontToken binary_integer;
          BEGIN
          ORDCOM.InitArg();
          ORDCOM.SetArg(range, 'BSTR');
          i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
          i := ORDCOM.GetProperty(RangeToken, 'Font', 0, FontToken);
          i := ORDCOM.SetProperty(FontToken, 'Name', fontname, 'BSTR');
          i := ORDCOM.DestroyObject(FontToken);
          i := ORDCOM.DestroyObject(RangeToken);
          return i;
        END FormatFontName;   
      /* Saubhik: This function is added to change the font style like Arial, Bookman, Century etc. */
      FUNCTION FormatFontSize(range varchar2, fontsize INTEGER)
        return binary_integer IS
        fontToken binary_integer;
          BEGIN
          ORDCOM.InitArg();
          ORDCOM.SetArg(range, 'BSTR');
          i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
          i := ORDCOM.GetProperty(RangeToken, 'Font', 0, FontToken);
          i := ORDCOM.SetProperty(FontToken, 'Size', fontsize, 'I2');
          i := ORDCOM.DestroyObject(FontToken);
          i := ORDCOM.DestroyObject(RangeToken);
          return i;
        END FormatFontSize;   
    /* Saubhik: This function is added to change the font color like Black, Blue etc. */
      FUNCTION FormatFontColor(range varchar2, fontcolor INTEGER)
        return binary_integer IS
        fontToken binary_integer;
          BEGIN
          ORDCOM.InitArg();
          ORDCOM.SetArg(range, 'BSTR');
          i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
          i := ORDCOM.GetProperty(RangeToken, 'Font', 0, FontToken);
              i := ORDCOM.SetProperty(FontToken, 'ColorIndex', fontcolor, 'I2');
          i := ORDCOM.DestroyObject(FontToken);
          i := ORDCOM.DestroyObject(RangeToken);
          return i;
        END FormatFontColor;
      * Invoke the Range method to obtain a range token. Then set the property value
      * at the specified range to the data required
      FUNCTION GetDataNum(range varchar2) RETURN binary_integer IS
      BEGIN
        ORDCOM.InitArg();
        ORDCOM.SetArg(range, 'BSTR');
        i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        i := ORDCOM.GetProperty(RangeToken, 'Value', 0, retNum);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        i := ORDCOM.DestroyObject(RangeToken);
        RETURN retNum;
      END GetDataNum;
      FUNCTION GetDataReal(range varchar2) RETURN double precision IS
      BEGIN
        ORDCOM.InitArg();
        ORDCOM.SetArg(range, 'BSTR');
        i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        i := ORDCOM.GetProperty(RangeToken, 'Value', 0, retReal);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        i := ORDCOM.DestroyObject(RangeToken);
        RETURN retReal;
      END GetDataReal;
      FUNCTION GetDataStr(range varchar2) RETURN varchar2 IS
      BEGIN
        ORDCOM.InitArg();
        ORDCOM.SetArg(range, 'BSTR');
        i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        i := ORDCOM.GetProperty(RangeToken, 'Value', 0, retStr);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        i := ORDCOM.DestroyObject(RangeToken);
        RETURN retStr;
      END GetDataStr;
      FUNCTION GetDataDate(range varchar2) RETURN Date IS
      BEGIN
        ORDCOM.InitArg();
        ORDCOM.SetArg(range, 'BSTR');
        i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        i := ORDCOM.GetProperty(RangeToken, 'Value', 0, retDate);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        i := ORDCOM.DestroyObject(RangeToken);
        RETURN retDate;
      END GetDataDate;
      FUNCTION InsertData(range varchar2, data DATE, type varchar2)
        RETURN binary_integer IS
      BEGIN
        ORDCOM.InitArg();
        ORDCOM.SetArg(range, 'BSTR');
        i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
        i := ORDCOM.SetProperty(RangeToken, 'Value', data, type);
        i := ORDCOM.DestroyObject(RangeToken);
        RETURN i;
      END InsertData;
      FUNCTION InsertDataReal(range varchar2,
                              data  double precision,
                              type  varchar2) RETURN binary_integer IS
      BEGIN
        ORDCOM.InitArg();
        ORDCOM.SetArg(range, 'BSTR');
        i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
        i := ORDCOM.SetProperty(RangeToken, 'Value', data, type);
        i := ORDCOM.DestroyObject(RangeToken);
        RETURN i;
      END InsertDataReal;
      FUNCTION InsertData(range varchar2, data varchar2, type varchar2)
        RETURN binary_integer IS
      BEGIN
        ORDCOM.InitArg();
        ORDCOM.SetArg(range, 'BSTR');
        i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
        i := ORDCOM.SetProperty(RangeToken, 'Value', data, type);
        i := ORDCOM.DestroyObject(RangeToken);
        RETURN i;
      END InsertData;
      * Insert a chart at the x and y position of the spreadsheet with the desired
      * height and width. Then also uses the ChartWizard to draw the graph with data
      * in a specified range area with a specified charting type.
      FUNCTION InsertChart(xpos   binary_integer,
                           ypos   binary_integer,
                           width  binary_integer,
                           height binary_integer,
                           range  varchar2,
                           type   varchar2) RETURN binary_integer IS
        charttype binary_integer := -4099;
      BEGIN
        ORDCOM.InitArg();
        i := ORDCOM.GetProperty(WorkSheetToken,
                                'ChartObjects',
                                0,
                                ChartObjectToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        ORDCOM.InitArg();
        ORDCOM.SetArg(xpos, 'I2');
        ORDCOM.SetArg(ypos, 'I2');
        ORDCOM.SetArg(width, 'I2');
        ORDCOM.SetArg(height, 'I2');
        i := ORDCOM.Invoke(ChartObjectToken, 'Add', 4, ChartObject1);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        i := ORDCOM.GetProperty(ChartObject1, 'Chart', 0, Chart1Token);
        ORDCOM.InitArg();
        ORDCOM.SetArg(range, 'BSTR');
        i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
        ORDCOM.InitArg();
        ORDCOM.SetArg(RangeToken, 'DISPATCH');
        IF type = 'xlPie' THEN
          charttype := -4102;
        ELSIF type = 'xl3DBar' THEN
          charttype := -4099;
        ELSIF type = 'xlBar' THEN
          charttype := 2;
        ELSIF type = 'xl3dLine' THEN
          charttype := -4101;
        END IF;
        ORDCOM.SetArg(charttype, 'I4');
        i := ORDCOM.Invoke(Chart1Token, 'ChartWizard', 2, DummyToken);
        i := ORDCOM.DestroyObject(RangeToken);
        i := ORDCOM.DestroyObject(ChartObjectToken);
        i := ORDCOM.DestroyObject(ChartObject1);
        i := ORDCOM.DestroyObject(Chart1Token);
        RETURN i;
      END InsertChart;
      * Save the Excel File. WARNING: Do not specify a filename that already exist
      * since there is no graphical context, Oracle would not be able to pop
      * out a warning message for existing file. This causes Excel to hang
      FUNCTION SaveExcelFile(filename varchar2) return binary_integer IS
      BEGIN
        dbms_output.put_line('Saving Excel file...');
        ORDCOM.InitArg();
        ORDCOM.SetArg(filename, 'BSTR');
        i := ORDCOM.Invoke(WorkBookToken, 'SaveAs', 1, DummyToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        RETURN i;
      END SaveExcelFile;
      * Close the Excel spreadsheet and exit from it
      FUNCTION ExitExcel return binary_integer is
      BEGIN
        dbms_output.put_line('Closing workbook and quitting...');
        ORDCOM.InitArg();
        ORDCOM.InitArg();
        ORDCOM.SetArg(FALSE, 'BOOL');
        dbms_output.put_line('Closing workbook...');
        i := ORDCOM.Invoke(WorkBookToken, 'Close', 0, DummyToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        i := ORDCOM.DestroyObject(WorkBookToken);
        ORDCOM.InitArg();
        dbms_output.put_line('Closing workbooks...');
        i := ORDCOM.Invoke(WorkBooksToken, 'Close', 0, DummyToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        i := ORDCOM.DestroyObject(WorkBooksToken);
        i := ORDCOM.Invoke(applicationToken, 'Quit', 0, DummyToken);
        IF (i != 0) THEN
          ORDCOM.GetLastError(error_src,
                              error_description,
                              error_helpfile,
                              error_helpID);
          dbms_output.put_line(error_src);
          dbms_output.put_line(error_description);
          dbms_output.put_line(error_helpfile);
        END IF;
        i := ORDCOM.DestroyObject(WorkSheetToken);
        i := ORDCOM.DestroyObject(WorkSheetToken1);
        i := ORDCOM.DestroyObject(applicationToken);
        i := ORDCOM.DestroyObject(ChartObjectToken);
        i := ORDCOM.DestroyObject(Chart1Token);
        i := ORDCOM.DestroyObject(ChartObject1);
        i := ORDCOM.DestroyObject(dummyToken);
        RETURN i;
      END ExitExcel;
    END ORDExcelSB;

  • Opening Excel Workbook Fails when run from Scheduled Task on Windows Server 2008 Rw

    Hi,
    I have a little vbs script that instantiates the Excel.Application object and then opens a work book to perform some tasks on it. The script runs fine when run from the command line. When I attempt to run it as a scheduled task (it is supposed to update
    data that is pulled from a SQL Server at regular intervals), it fails with the following error:
    Microsoft Office Excel cannot access the file 'c:\test\SampleWorkbook.xlsm'. There are several possible reasons: .....
    The file does exist. The path reported in the error is correct. The account under which the task is running is the same account I use to run it from the command line. User Account Control is not enabled, and the task is set up to run with highest privileges.
    When I run the same script through the Task Scheduler from a Windows Server 2003 machine, it works without issue.
    I was just wondering if somebody on this forum has run into a similar issue in connection with Windows Server 2008 R2 and figured out what the magic trick is to make it work. I'm sure it is rights related, but I haven't quite figured out what which rights
    are missing.
    Thanks in advance for any advice you may have.

    This is truly killing me ... trying to get it working on Windows Server 2012 without success.
    I desperately need to automate running Excel macros in a "headless" environment, that is non-interactive, non-GUI, etc.
    I can get it to work using Excel.Application COM, either via VBScript or Powershell, successfully on many other Windows systems  in our environment - Windows Server 2008 R2, Windows 7 (32-bit), etc.,  -BUT-
    The two servers we built out for running our automation process are Windows Server 2012 (SE) - and it just refuses to run on the 2012 servers - it gives the messages below from VBScript and PowerShell, respectively- 
    I have tried uninstalling and re-installing several different versions of Microsoft Excel (2007 Standard, 2010 Standard, 2010 Professional Plus, 32-bit vs. 64-bit, etc.), but it makes no difference.
    Would be extremely grateful if any one out there has had any success in running Excel automation on Server 2012 in a non-interactive environment that they could share.
    ( I have tried adding the "%windir%\syswow64\config\systemprofile\desktop"
    folder, which did fix the issue for me when testing on Windows Server 2008 R2, but sadly did not resolve it on Windows Server 2012 )
    [VBScript error msg]
    Z:\TestExcelMacro.vbs(35, 1) Microsoft Office Excel: Microsoft Office Excel cannot
    access the file 'Z:\TestExcelMacro.xlsm'. There are several possible reasons:
    • The file name or path does not exist.
    • The file is being used by another program.
    • The workbook you are trying to save has the same name as a currently open work
    [Powershell error msg]
    Exception calling "Add" with "0" argument(s): "Microsoft Office Excel cannot open or save any more documents because th
    ere is not enough available memory or disk space.
     To make more memory available, close workbooks or programs you no longer need.
     To free disk space, delete files you no longer need from the disk you are saving to."
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : ComMethodTargetInvocation
    You cannot call a method on a null-valued expression.
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : InvokeMethodOnNull

  • Excel integration with Entry and Approval for SSM not working

    Iu2019m having trouble getting excel integrated with E&A for being able to enter large number of historic data points into a cube-built model u2013 Iu2019ve gone through all the docs several times and there is no good concrete explanation on how to do this. I keep getting the following error message:
    Error opening Excel Automation server can't create object. This can be caused by:
    1. - The application is not installed on your machine
    2. - The browser security does not support ActiveX scripts.
    3. - Your were prompted to run ActiveX and you said No, if that is the cause close all browser instances and reopen.
    However, I've done the following:
    -          Iu2019ve installed the excel add-in on both the server and my local machine, and Iu2019ve enabled the add-in part in Excel on my local machine.
    -          The browser security is definitely set to accept all active X scripts
    -          I am never prompted to run activeX when I select u201CHistorical Datau201D within entry/approval. I just get the above error message.
    -          Iu2019ve flushed cache and restarted listener several times.
    What am I missing? I donu2019t see it in any of the docs.
    Thanks!

    Robb,
    Looking at what you've done, there doesn't seem to be an obvious answer. The best suggestion I can make is to fill out a support ticket on this. There must be other factors at work here that will require a deeper look.
    Regards,
    Bob

Maybe you are looking for

  • How do I login to my iMac when it rejects the same password always used?

    I use the same login password for my iMac and Macbook Pro however, the login password no longer works for my iMac. It still works for my Macbook Pro... I checked all the silly things such as caps lock etc. to no avail. Does anyone know how I can acce

  • Migration of Oracle DB (32 Bit) to 64 Bit

    Source : Linux OS 32 bit Processor Xeon 32 bit x 2 HT enabled Target Linux OS 64 bit (AMD processor) Processor Intel Quad x 2 HT enabled I wanted to take OS backup of full oracle software and DB from source and paste it to target machine Will it be w

  • Error in linking xla tables with gl

    Hi , We have a requirement in which we have to fetch data from xla tables to post into GL. below is the query i am using to fetch the data, but i am not able to fetch any value from it. Please let me know if i have missed any join condition or there

  • URGENT: JAAS Login Module in Clustered Environment

    Hello all, I've created out own JAAS Login Module which works perfectly on a single-node environment... i dropped the jar in /server/additional-lib and modified library.txt and authschemes.xml as needed. Now that we need to deploy it in a clustered n

  • 테이블의 COLUMN 이름을 변경하는 방법

    제품 : ORACLE SERVER 작성날짜 : 2003-08-04 일반적으로 table column의 이름을 변경할수 있는 방법은 sql syntax에서 지원되지 않는다. 그러므로 다음과 같은 3가지 방법을 이용해 컬럼의 이름을 변경할수 있겠다. 1. create table .. as select 이용하여 loc 컬럼을 locc로 변경 SQL> desc dept Name Null? Type DEPTNO NOT NULL NUMBER(2) DNAM