Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have the following problem.
I have a macro that export some images of some sheets on my project.
It's working fine but sometimes it hangs on executing with the following mensage: "Executando macro" ( My QlikView is in portuguese) - It would be similar to "Macro Running".
After restart QlikViel for about 4 times it runs properly again.
Can anyone help me?
Can you share the app or macro code João?
The app I can't, but the macro can I post here as txt file ok?
Sure, no problem.
There it is
--------------------------------------------------------------------------------------------------------------------------------------------------------
Sub ReloadDoc
ActiveDocument.Reload
ActiveDocument.Save
End sub
' Grupo do Rio de janeiro (1 a 20)
FUNCTION ExportObjectToJpg1
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH01").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb1.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg2
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH22").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dash2.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg3
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH333").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb3.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg4
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH04").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb4.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg5
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH05").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb5.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg6
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH66").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb6.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg7
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH77").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb7.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg8
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH08").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb8.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg9
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH09").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb9.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg10
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH10").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb10.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg11
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH11").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb11.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg12
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH122").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb12.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg13
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH133").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb13.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg14
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH144").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb14.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg15
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH15").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb15.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg16
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH16").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb16.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg17
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH17").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb17.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg18
if ActiveDocument.Variables("vIncrement").getcontent.string < ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH18").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb18.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg19
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH19").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb19.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg20
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH20").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb20.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg21
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH21").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb21.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg22
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH334").ExportBitmapToFile "\\quality.ad\Arquivos\VOL1\SUP - QUALIDADE\Dashboard_diretoria\Imagens\Dashb22.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg23
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH335").ExportBitmapToFile "\\quality.ad\Arquivos\VOL1\SUP - QUALIDADE\Dashboard_diretoria\Imagens\Dashb23.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg24
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH336").ExportBitmapToFile "\\quality.ad\Arquivos\VOL1\SUP - QUALIDADE\Dashboard_diretoria\Imagens\Dashb24.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg25
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH337").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb25.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg26
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH338").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb26.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg27
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH339").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb27.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg28
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH340").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_BHG\Imagens\Dashb28_BHG_01.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg29
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH341").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_BHG\Imagens\Dashb29_BHG_02.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg30
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH342").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_BHG\Imagens\Dashb30_BHG_03.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg31
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH343").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_BHG\Imagens\Dashb31_BHG_04.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg32
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH344").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_BHG\Imagens\Dashb32_BHG_05.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg33
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH345").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_GRU\Imagens\Dashb33_GRU_01.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg34
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH346").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_GRU\Imagens\Dashb34_GRU_02.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg35
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH347").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_GRU\Imagens\Dashb35_GRU_03.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg36
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH348").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_GRU\Imagens\Dashb36_GRU_04.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg37
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH349").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_GRU\Imagens\Dashb37_GRU_05.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg38
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH350").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_FOTOTICA\Imagens\Dashb38_FOTOTICA_01.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg39
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH351").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_FOTOTICA\Imagens\Dashb39_FOTOTICA_02.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg40
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH352").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_FOTOTICA\Imagens\Dashb40_FOTOTICA_03.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg41
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH353").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_FOTOTICA\Imagens\Dashb41_FOTOTICA_04.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg42
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
Application.WaitForIdle()
ActiveDocument.Sheets("SH354").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_FOTOTICA\Imagens\Dashb42_FOTOTICA_05.png"
Application.WaitForIdle()
end if
Increment()
END FUNCTION
'''' always create a new page change the number of the variable vSheets to a total amount of pages
Sub Increment
TheVal = ActiveDocument.Variables("vIncrement").getcontent.string
TheVal = TheVal + 1
ActiveDocument.Variables("vIncrement").SetContent TheVal, True
End sub
--------------------------------------------------------------------------------------------------------------------------------------------
Hi João,
Try with the following:
' Grupo do Rio de janeiro (1 a 20)
FUNCTION ExportObjectToJpg1
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH01").ExportBitmapToFile "C:\Users\eferibe\Desktop\Teste\Dashb1.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg2
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH02").ExportBitmapToFile "C:\Users\eferibe\Desktop\Teste\Dash2.png"
'Application.WaitForIdle()
end if
Bolded parts are the commands that I changed.
I only tested for two sheets in my example "SH01" and "SH02" and it worked fine.
My guess is that the second Application.WaitForIdle() you were putting was holding the macro somehow.
Edit the other macro parts as well, i've only done twice for testing purposes.
Felipe.
I'll try and feed back you in a couple of days.
Thanks
Hopefully it helps .
Hi Felip,
It didn't worked, follows the script
Sub ReloadDoc
ActiveDocument.Reload
ActiveDocument.Save
End sub
FUNCTION ExportObjectToJpg1
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH01").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb1.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg2
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH22").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dash2.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg3
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH333").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb3.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg4
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH04").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb4.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg5
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH05").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb5.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg6
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH66").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb6.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg7
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH77").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb7.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg8
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH08").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb8.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg9
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH09").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb9.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg10
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH10").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb10.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg11
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH11").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb11.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg12
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH122").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb12.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg13
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH133").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb13.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg14
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH144").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb14.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg15
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH15").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb15.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg16
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH16").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb16.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg17
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH17").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb17.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg18
if ActiveDocument.Variables("vIncrement").getcontent.string < ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH18").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb18.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg19
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH19").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb19.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg20
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH20").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb20.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg21
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH21").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb21.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg22
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH334").ExportBitmapToFile "\\quality.ad\Arquivos\VOL1\SUP - QUALIDADE\Dashboard_diretoria\Imagens\Dashb22.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg23
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH335").ExportBitmapToFile "\\quality.ad\Arquivos\VOL1\SUP - QUALIDADE\Dashboard_diretoria\Imagens\Dashb23.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg24
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH336").ExportBitmapToFile "\\quality.ad\Arquivos\VOL1\SUP - QUALIDADE\Dashboard_diretoria\Imagens\Dashb24.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg25
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH337").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb25.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg26
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH338").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb26.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg27
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH339").ExportBitmapToFile "I:\SUP - QUALIDADE\DashboardOTRS\Imagens\Dashb27.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg28
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH340").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_BHG\Imagens\Dashb28_BHG_01.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg29
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH341").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_BHG\Imagens\Dashb29_BHG_02.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg30
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH342").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_BHG\Imagens\Dashb30_BHG_03.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg31
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH343").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_BHG\Imagens\Dashb31_BHG_04.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg32
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH344").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_BHG\Imagens\Dashb32_BHG_05.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg33
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH345").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_GRU\Imagens\Dashb33_GRU_01.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg34
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH346").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_GRU\Imagens\Dashb34_GRU_02.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg35
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH347").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_GRU\Imagens\Dashb35_GRU_03.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg36
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH348").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_GRU\Imagens\Dashb36_GRU_04.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg37
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH349").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_GRU\Imagens\Dashb37_GRU_05.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg38
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH350").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_FOTOTICA\Imagens\Dashb38_FOTOTICA_01.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg39
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH351").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_FOTOTICA\Imagens\Dashb39_FOTOTICA_02.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg40
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH352").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_FOTOTICA\Imagens\Dashb40_FOTOTICA_03.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg41
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH353").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_FOTOTICA\Imagens\Dashb41_FOTOTICA_04.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
FUNCTION ExportObjectToJpg42
if ActiveDocument.Variables("vIncrement").getcontent.string <= ActiveDocument.Variables("vSheets").getcontent.string then
'Application.WaitForIdle()
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("SH354").ExportBitmapToFile "I:\SUP - QUALIDADE\Dashboard_FOTOTICA\Imagens\Dashb42_FOTOTICA_05.png"
'Application.WaitForIdle()
end if
Increment()
END FUNCTION
'''' always create a new page change the number of the variable vSheets to a total amount of pages
Sub Increment
TheVal = ActiveDocument.Variables("vIncrement").getcontent.string
TheVal = TheVal + 1
ActiveDocument.Variables("vIncrement").SetContent TheVal, True
End sub
Adding some information.
I have a serie of variables configured on the document variables witch save the time of last execution for keep the execution on loop on each 15 minutes for example.
This makes any difference?