On Jun 27, 2009, at 5:12 AM, Bernard Marcelly wrote:
Hi Hal,
Message de Hal Vaughan date 2009-06-26 08:41 :
Sub InsertAutoMacroText
oDoc = ThisComponent
oCurs = oDoc.getCurrentController().getViewCursor()
iEnd = false
iCount = 0
Do
'Go back one character, then get that character and put it in a
separate variable
'for comparison.
oCurs.goLeft(1, true)
sKey = oCurs.getString()
sChar = Left(sKey, 1)
'BUG: This next line throws an error if we try to use this at the
start of a document.
Methods goLeft and goRight return a boolean True if the move could
be done, False if it failed.
if oCurs.goLeft(1, True) then
' do your job
else
' already at start of text
end
Thanks! I see that now, but I've got the code in to check the length
-- there was a delay in my emails going through, so we have a lag time
here. I have it working with a length check for now. I may switch to
this, since it's more concise, but I generally avoid re-writing
whenever I can. I wish I had seen this before I wrote my patch!
Hal
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]