EBDN - Community - Question & Answers

  Tuesday, 20 August 2019
  1 Replies
  1.1K Visits
0
Votes
Undo
I’m developing a VBA Macro to replace all forms of Sheets at a Document in an Enginnering Base Project.

Just to you know how de Macro works, there is an Attribute ‘aucAttrOrigin’ that Im using to store the ‘Model’ of the sheet that must be replaced.
After collect the Sheets and respective Models I call the following Sub ‘SubsFolha’ (ReplaceSheets):

Sub SubsFolhas()
i Cont = 0
For Each AuxMod in colTotal
Set oModelo = AuxMod.dfModelo
For Each AuxFolha in AuxMod.colFolhas
iCont = iCont + 1
txtln1 = "Substituindo folhas com a Origem: " & oModelo.Name & vbNewLine
txtln2 = "Substituindo a folha: " & AuxFolha.FullName & vbNewLine
txtln3 = "Folha " & iCont & " de " & iFlAtualizadas
UserForm2.Label1.Caption = txtln1 & txtln2 & txtln3
UserForm2.Repaint
Set oFolha = AuxFolha
Call oFolha.ReplaceFormSheet (oModelo)
Next
Next
End Sub



When I run this Sub step by step using a Stop before call the ‘ReplaceFormSheet’ the macro runs pretty well. But, when I try to run the Macro without the stop, it just get into a Loop that I have to quit the EB. I’ve already tried to use a Delay after the replacement but it worked the same way.

Do you have any idea of how to make this works without the stop?