Położenie radiobutton'a
: pt lip 11, 2014 11:58 am
				
				Witam,
jest jakiś sposób, aby uzyskać informację nad jaką komórką arkusza znajduje się dany radiobutton? Kod nad którym pracuję:
To miejsce dokładnie (druga pętla for):
Pozdrawiam
			jest jakiś sposób, aby uzyskać informację nad jaką komórką arkusza znajduje się dany radiobutton? Kod nad którym pracuję:
Kod: Zaznacz cały
Sub getStatesOfForms
rem declarations
	Dim Sheet As Object
	Dim DrawPage As Object
	Dim Form As Object
	Dim Form2 As Object
	Dim Ctl As Object
	Dim I as Integer
	Dim J As Integer
	Dim Cell As Object
	Dim Cell2 As Object
	Dim testChar As Integer
	Dim Sheets As Object
	Dim Flags As Long
	Dim CellRange As Object
	Dim countSheets As Object
rem **********************************************************************
Doc = ThisComponent
For J = 0  To Doc.Sheets.Count - 1
	Sheet = Doc.Sheets.GetByIndex(J)   rem ktory index (0 - pierwszy index)
	Sheet.unProtect("")   rem zdjecie ochrony z arkusza (bez hasla)
	DrawPage = Sheet.Drawpage  
	
	
	rem usuwanie komentarzy		
	Cell = Sheet.getCellRangeByName("A1:P50")
	Flags = com.sun.star.sheet.CellFlags.ANNOTATION
	Cell.clearContents(Flags)	
	
	rem w petli do komorki o wspolrzednych (18, I) wpisuje stan danej formatki	
	If DrawPage.Count > 0 then
	Form = DrawPage.Forms.GetbyIndex(0)
		For I = 0 To DrawPage.Count - 1
			Cell2 = Sheet.getCellByPosition(12, I)   ' to bym wyrzucil
			Form2 = Form.GetbyIndex(I)	
			testChar = asc(Form2.name)
			If testChar = 67 or testChar = 79 Then rem sprawdzamy, czy pobrana formatka jest optionbuttonem lub checkboxem (kontrola kodu ASCII pierwszego znaku)
				Cell2.String = Form2.state     'w tym miejscu: pobranie informacji o tej komórce + wpisanie tam stanu
			End If
		Next I
	End If
	
Next J
End Sub
Sub hello
MsgBox "Hello!"
End SubKod: Zaznacz cały
If testChar = 67 or testChar = 79 Then rem sprawdzamy, czy pobrana formatka jest optionbuttonem lub checkboxem (kontrola kodu ASCII pierwszego znaku)
				Cell2.String = Form2.state     'w tym miejscu: pobranie informacji o tej komórce + wpisanie tam stanu
			End If