como hago? excel - radiobutton

Post Reply
User avatar
goosfancito
Posts: 1955
Joined: Fri Oct 07, 2005 7:08 pm

como hago? excel - radiobutton

Post by goosfancito »

Hola.
Tengo una planilla en excel que desde mi app necesito que se seleccione uno de los radio button que tiene esa planilla.
esa planilla a mi me la dan creada, por lo tanto no puedo re-hacerla.

gracias.
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
Antonio Linares
Site Admin
Posts: 42521
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 76 times
Contact:

Re: como hago? excel - radiobutton

Post by Antonio Linares »

Prueba con:

oExcel = CreateObject( "Excel.Application" )
oSheet = oExcel:Get( "ActiveSheet" )
oSheet:Shapes("Option Button 1").ControlFormat.Value = .T.

http://stackoverflow.com/questions/24205454/excel-vba-option-button-selected-as-default-on-start
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
goosfancito
Posts: 1955
Joined: Fri Oct 07, 2005 7:08 pm

Re: como hago? excel - radiobutton

Post by goosfancito »

gracias Antonio!
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
Posts: 1955
Joined: Fri Oct 07, 2005 7:08 pm

Re: como hago? excel - radiobutton

Post by goosfancito »

mi tira el siguiente error:

Source\macro.prg(35) Error E0030 Syntax error: "syntax error at '.'"


en el codigo:

Code: Select all | Expand

 oSheet:shapes("Botóndeopción1176_Haga_clic_en").ControlFormat.Value = .T.
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
karinha
Posts: 7935
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Been thanked: 3 times
Contact:

Re: como hago? excel - radiobutton

Post by karinha »

Intente:

Code: Select all | Expand


   oSheet:shapes("Botóndeopción1176_Haga_clic_en").Object.Value = .T.
 
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
Antonio Linares
Site Admin
Posts: 42521
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 76 times
Contact:

Re: como hago? excel - radiobutton

Post by Antonio Linares »

En vez de "." tienes que usar ":"

Prueba así:

oSheet:Shapes("Option Button 1"):ControlFormat:Value = .T.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply