Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
The macro below renames expression Labels. The cycle matches the labels to the list.
Without this text: MsgBox( "Text" )
Renames only first Label from the cycle.
Together with this text it works out correctly with all Labels.
Should work with all Labels without displaying a message and the need to click "OK".
Can you please tell me what's my mistake? Or than replace MsgBox?
'-->
Sub Test1
set App = ActiveDocument.GetApplication
SET QVDoc = App.OpenDoc ("F:\Разработка\Чуваева\20395_Глоссарий\Учетная цена по компании (УЦК январь 2018). Движения.qvw","","")
ActiveDocument.Activate 'QVDoc.Activate '
'7. '======== Renames Labels ===================
SET Glos = QVDoc.GetSheetObject("Glos")
Gw = Glos.GetColumnCount
Gh = Glos.GetRowCount
set CellG = Glos.GetCells2(0,0,Gw,Gh)
QVDoc.Sheets(0).Activate
FOR GLi = 1 to Gh-1 'Перебор по строкам Глоссария от 0
For ColIter = 0 to Eval(CellG(GLi)(0).Text).GetProperties.Expressions.Count-1
MsgBox( "Text" )
'QVDoc.GetApplication.Sleep 1000 ' Doesn't work.
'ActiveDocument.GetApplication.Sleep 1000 ' Doesn't work.
IF (CellG(GLi)(4).Text + "|" + Eval(CellG(GLi)(0).Text).GetProperties.Expressions.Item(ColIter).Item(0).Data.ExpressionVisual.Label.v) = CellG(GLi)(2).Text THEN
set p = Eval(CellG(GLi)(0).Text).GetProperties
p.Expressions.Item(ColIter).Item(0).Data.ExpressionVisual.Label.v = CellG(GLi)(3).Text
Eval(CellG(GLi)(0).Text).SetProperties p
End If
Next
NEXT
msgbox("End.")
End Sub
'--<
what happens if you call this function instead of sleep?
function dteWait
dteWait = DateAdd("s", 10, Now())
Do Until (Now() > dteWait)
Loop
end function
or maybe this statement:
ActiveDocument.GetApplication.WaitForIdle
what happens if you call this function instead of sleep?
function dteWait
dteWait = DateAdd("s", 10, Now())
Do Until (Now() > dteWait)
Loop
end function
or maybe this statement:
ActiveDocument.GetApplication.WaitForIdle
Thank you very much!
ActiveDocument.GetApplication.WaitForIdle worked!