Ver Mensaje Individual
  #1  
Antiguo 09-12-2014
Avatar de lmpadron
lmpadron lmpadron is offline
Miembro
 
Registrado: feb 2009
Ubicación: Habana, Cuba
Posts: 204
Reputación: 18
lmpadron Va por buen camino
problemas con propiedades OLE de BCB6 a 2010

Saludos comunidad

Ya se como llamar a excel usando CreateObject pero al parecer eso no fue lo único que cambio del BCB6 al CodeGear 2010, el resto de mi código pude notar que no funciona, imagino que la forma de llamar a las propiedades de Excel no sea la misma, o sea el Item, Cells, etc... les dejo el código para que me ayuden a actualizarlo o me indiquen como hacerlo:

Código:
Variant Excel, Libro, Hoja, Celda;
Excel = Variant::CreateObject("Excel.Application");

Excel.OlePropertySet("Visible", false);
Libro = Excel.OlePropertyGet("Workbooks");
Libro.OleProcedure("Add");

Hoja = Libro.OlePropertyGet("Item", 1);
Libro = Hoja.OlePropertyGet("Worksheets");

char* Pepe= new char[ADOQuery7->FieldByName("Pepe")->Text.Length() + 10];
StrLCopy(Pepe,ADOQuery7->FieldByName("Pepe")->Text.c_str(),ADOQuery7->FieldByName("Pepe")->Text.Length());


Hoja.OlePropertyGet("Cells").OlePropertyGet("Item", 5, 1).OlePropertySet("Value", "Codigo");
Hoja.OlePropertyGet("Cells").OlePropertyGet("Item", 6, 1).OlePropertySet("Value", Pepe);

Celda = Hoja.OlePropertyGet("Cells").OlePropertyGet("Item", 5,1);
Celda.OlePropertyGet("Font").OlePropertySet("Bold", true);

Excel.OlePropertySet("DisplayAlerts", false);
Excel.OlePropertyGet("Workbooks").OlePropertyGet("Item", 1).OleProcedure("SaveAs", SaveDialog1->FileName.c_str());
Excel.OlePropertySet("Visible", true);
Excel = Unassigned;
ME devuleve el siguiente error

---------------------------
Debugger Exception Notification
---------------------------
Project Project1.exe raised exception class EOleSysError with message 'Nombre desconocido'.
---------------------------
Break Continue Help
---------------------------

Gracias de antemano por su tiempo
__________________
Nunca esta de más volver a ver la "Guia de Estilo" o "La Otra Guia de Estilo". Recuerda siempre usar los "Tags" para una mejor legibilidad de tu código.


Cuando miras fijamente al abismo, este te devuelve la mirada


oo______ooo_____ooo_ooooooo_____ooo____oooooo____ooooooo______oooo____ooo____oo_
oo______oooo___oooo_oo____oo__oo___oo__oo____oo__oo____oo___oo____oo__oooo___oo_
oo______oo_oo_oo_oo_oo____oo_oo_____oo_oo_____oo_oo____oo__oo______oo_oo_oo__oo_
oo______oo__ooo__oo_oooooo___ooooooooo_oo_____oo_ooooooo___oo______oo_oo__oo_oo_
oo______oo_______oo_oo_______oo_____oo_oo____oo__oo____oo___oo____oo__oo___oooo_
ooooooo_oo_______oo_oo_______oo_____oo_oooooo____oo_____oo____oooo____oo____ooo_
________________________________________________________________________________
Responder Con Cita