Alaska Software Inc. - CreateObject and excel 2013 not working
Username: Password:
AuthorTopic: CreateObject and excel 2013 not working
Marco Antonio AguiarCreateObject and excel 2013 not working
on Thu, 09 Oct 2014 18:50:42 +0100
Hi to all

CreateObject( "Excel.Application" ) not working with
win 8.1 and office 2013. Any sugestions ?

Rgds
Marco
Thomas BraunRe: CreateObject and excel 2013 not working
on Fri, 10 Oct 2014 08:33:08 +0200
Marco Antonio Aguiar wrote:

> CreateObject( "Excel.Application" ) not working with
> win 8.1 and office 2013. Any sugestions ?

Sorry but the first thing I would suggest is to give more details about the
problem you are having, such as code samples, the actual error message etc.

I don't think "not working" ist the error message you get? 

Thomas
Marco Antonio AguiarRe: CreateObject and excel 2013 not working
on Fri, 10 Oct 2014 09:00:05 +0100
On 10/10/2014 07:33, "Thomas Braun" wrote:
> Marco Antonio Aguiar wrote:
>
>> CreateObject( "Excel.Application" ) not working with
>> win 8.1 and office 2013. Any sugestions ?
>
> Sorry but the first thing I would suggest is to give more details about the
> problem you are having, such as code samples, the actual error message etc.
>
> I don't think "not working" ist the error message you get? 
>
> Thomas
>

Some times I get no message and the program just close.
Some times Excel start to open and the it appears one window with the 
title Excel and that says something like that ( translated from 
portuguese ):
" We are sorry, but one error with excel is not allowing to work 
correctly. Excel needs to be closed. Do you want to repair the error?"
There are 3 buttons :
1-Repair now
2-Close
3-Help
If i click repair now it opens one page in the internet explorer.

In my program I create a begin sequence / end sequence to try to 
retrieve the error, and some times it appears ( not always ) :

    oExel := CreateObject( "Excel.Application" )
    if oExel == NIL
       cErro += "Error : " + "Excel Application"          + P_CRLF
       cErro += "Number: " + Var2Char( ComLastError()   ) + P_CRLF
       cErro += "Descr.: " + Var2Char( ComLastMessage() ) + P_CRLF
       MsgBox( cErro )
       Break
    endif

ComLastError return "-2146959355"
ComLastMessage return "A execuçao no servidor falhou" ( the execution on 
server did not work )

What can I do ?
Marco Antonio AguiarRe: CreateObject and excel 2013 not working
on Thu, 16 Oct 2014 16:31:53 +0100
On 09/10/2014 18:50, "Marco Antonio Aguiar" wrote:
> Hi to all
>
> CreateObject( "Excel.Application" ) not working with
> win 8.1 and office 2013. Any sugestions ?
>
> Rgds
> Marco
>
I found I had not installed the comActixcomponents in my new computer, 
after that it works but only with xbase 1.9.

With xbase 2.0 still not working! No error and no message, just program 
go out!

Have anyone tryied this function CreateObject( "Excel.Application" ) 
with xBase 2.0 ?
César Calvo Re: CreateObject and excel 2013 not working
on Thu, 16 Oct 2014 23:33:04 +0200
Yes, it works fine ActiveX with Office 2010 and SQLExpress, see below:

METHOD PRUEBA CLASS PRUSQL
LOCAL cFIL, cCon, oCon, cSQL, oCur, nCol, B, oCol, I
LOCAL oExcel, oBook, cHoja, oSheet, nHandle, nFil, aDat := {}

 HOJA EXCEL DONDE SE LISTARAN LOS DATOS

cFIL := CurDrive() + ":\" + CurDir() + "\" + 'MYEXCEL.XLSX'

oExcel := CreateObject("Excel.Application")

IF Empty( oExcel )
   Infobox( "Excel no está instalado" )
   RETURN
ENDIF

oExcel:DisplayAlerts := .F.
oExcel:visible       := .F.

oBook  := oExcel:workbooks:Add(1)

cHoja := "Hoja1"

oSheet := oBook:Worksheets(cHoja)

oBook:SaveAs(cFil)

 Quit Excel
oExcel:Quit()
oExcel:Destroy()

 LISTADO DE LOS NOMBRES DE LAS COLUMNAS PARA CADA UNA DE LAS TABLAS

cFIL := cRut + "PRUEBAS.accdb"

cCon := "DBE=ODBCDBE"
cCon += ";DSN=MS Access Database"
cCon += ";Driver=Microsoft Access Driver (*.mdb, *.accdb)"
cCon += ";FIL=MS Access Database"

cCon += ";DBQ=" + cFIL + ";UID=admin;"

oCon := SQLConnection():new()

IF !oCon:driverConnect(nil, cCon)
   MsgBox("Unable to connect to server!")
   ELSE
   oCur := SQLListColumns():new(oCon)
   oCur:Execute()
   nCol := oCur:FCount()

    HOJA EXCEL CON LOS NOMBRES DE LAS COLUMNAS

   cFIL := CurDrive() + ":\" + CurDir() + "\" + 'MYEXCEL.XLSX'

   oExcel := CreateObject( "EXCEL.APPLICATION" )

   IF Empty( oExcel )
      Infobox( "Excel no está instalado" )
      RETURN
   ENDIF

   oBook := oExcel:workbooks:open(cFIL)

   oExcel:Visible := .F.

   oSheet := oExcel:Worksheets( "Hoja1" )

   FOR B = 1 TO nCol
      oSheet:Cells(1,B):Interior:Color = rgbYellow
      oSheet:Cells(1,B):Borders:LineStyle = xlContinuous
      oSheet:Cells(1,B):Value := oCur:FieldName(B)
   NEXT

   oBook:Save()

    ESTAS SON LAS FILAS, AÑADIR LOS VALORES A LA HOJA EXCEL

   DO WHILE !oCur:EOF()

      nFil := oCur:Recno() + 1

      FOR B = 1 TO nCol
         oSheet:Cells(nFil,B):Value := oCur:FieldGet(B)
      NEXT

      oBook:Save()

      oCur:Skip()

   ENDDO

   FOR B = 1 TO nCol

      oSheet:Columns(B):EntireColumn:AutoFit
      oSheet:Columns(B):HorizontalAlignment = xlCenter

   NEXT

   oBook:Save()

   oBook:close(.T.)

   oExcel:Quit()
   oExcel:Destroy()

   oCur:close()

ENDIF

oCon:destroy()

Infobox("Terminado, se ha creado " + cFIL,"Atención")

RETURN self


Regards,
César.


"Marco Antonio Aguiar" escribió en el mensaje de 
noticias:2ab3fc4$1b886c25$145ba@news.alaska-software.com...

On 09/10/2014 18:50, "Marco Antonio Aguiar" wrote:
> Hi to all
>
> CreateObject( "Excel.Application" ) not working with
> win 8.1 and office 2013. Any sugestions ?
>
> Rgds
> Marco
>
I found I had not installed the comActixcomponents in my new computer,
after that it works but only with xbase 1.9.

With xbase 2.0 still not working! No error and no message, just program
go out!

Have anyone tryied this function CreateObject( "Excel.Application" )
with xBase 2.0 ?