I created a function and a userform for update the % of my progress bar depending of where the code is. But the problem is that the progress bar don't update alone, it updates only when i close it. (it open a new progress bar with the next %)
This is the userform
Private Sub UserForm_Activate()
UserForm1.Height = 121.5
progression = taille_progressbar
Image_barre.Width = progression * 1.5
Label_barre.Caption = progression & "%"
DoEvents
Application.ScreenUpdating = True
UserForm1.Height = 136.5
End Sub
This is the call
taille_progressbar = 0
UserForm1.Show
cn.Open (ConnectionString)
rs.Open "TRUNCATE Direction_Prix_proxi.prix_crf;", cn
rs.Open "TRUNCATE Direction_Prix_proxi.prix_crf_exp;", cn
rs.Open "TRUNCATE Direction_Prix_proxi.prix_int_exp;", cn
rs.Open "TRUNCATE Direction_Prix_proxi.prix_int_cnt;", cn
rs.Open "TRUNCATE Direction_Prix_proxi.prix_u;", cn
rs.Open "LOAD DATA LOCAL INFILE '\tomatisation\\prix_concurrents.csv" & _
"' INTO TABLE direction_prix_proxi.prix_crf FIELDS TERMINATED BY ';' LINES TERMINATED BY '\n' IGNORE 2 LINES" & _
" (SIGMA, @PRIX) set PRIX= replace(@PRIX, ',','.');", cn
rs.Open "Delete FROM direction_prix_proxi.prix_crf WHERE (SIGMA = 0);", cn
rs.Open "UPDATE direction_prix_proxi.matrice_sigma sgm INNER JOIN direction_prix_proxi.prix_crf ref on sgm.SIGMA = ref.SIGMA SET sgm.prix_crf_cty = ref.PRIX;", cn
taille_progressbar = taille_progressbar + 20
UserForm1.Show
rs.Open "LOAD DATA LOCAL INFILE '\\\\ytkytkykty\\tkkktyytk\\16.Proxi\\Fichiers_automatisation\\prix_concurrents.csv" & _
"' INTO jrtjtrjtrjtrjtrjFIELDS TERMINATED BY ';' LINES TERMINATED BY '\n' IGNORE 2 LINES" & _
" (@dummy, @dummy, @dummy, @dummy, @dummy, @dummy, @dummy, @dummy, SIGMA, @PRIX) set PRIX= replace(@PRIX, ',','.');", cn
rs.Open "Delete FROM jrtrjtrjf_exp WHERE (SIGMA = 0);", cn
rs.Open "UPDATE rtjtrjtrjtj sgm INNER JOIN direction_prix_proxi.prix_crf_exp ref on sgm.SIGMA = ref.SIGMA SET sgm.prix_crf_exp = ref.PRIX;", cn
taille_progressbar = taille_progressbar + 20
UserForm1.Show