From 11:00 PM CDT Friday, Nov 8 - 2:30 PM CDT Saturday, Nov 9, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

GDI Error & Access violation error

Hi,

I am using report template and updating it through the script as per the requirement. The report template composed of 22 pages, based on condition some pages are need to be deleted before updating and exporting to PDF file.

I am doing of lot of updates in every page through script and did a "report.refresh" at the end of script before generating PDF file. I got the below error in the refresh line,

Durai26_2-1698738817080.png

 

DEBUG: Since i used many functions and doing lot of updates, I inserted "report.refresh" command in several places to identify exactly where the error started. I found it was occurring while deleting the report worksheet, find below sample code,

Durai26_3-1698739007637.png

 

After deleted the sheets as per condition, when it executes the "report.refresh"[ colored in red], its started throwing error: "-2147418113(GDI+ Error) The method performed an arithmetic operation that produces a numeric overflow". No error in the "report.refresh" command used inside for loop.

 

All the lines executed followed this for loop are started throwing " -2147418113Access violation at address 0000000000FB0617 in module 'DIAdem.exe'. Read of address 0000000000000023" error.

 

Any suggestions to overcome this error. What the root cause for this?

 

Note: I am running DIAdem in silent mode [invisible mode]. Using DIAdem 2023 version. I am not getting any error while running same script by keeping DIAdem in visible mode, but would like to do it in silent mode.

Info: If I comment the report sheet deletion for loop function, then my complete scripts runs fine without any error.

0 Kudos
Message 1 of 2
(551 Views)

Hi Durai26,

 

It is not recommended to delete sheets within a "for each" loop. Instead, try to run through the sheets backwards to avoid subsequent errors.

dim i, sheet_name, msg
for i = Report.Sheets.Count to 1 step -1
  sheet_name = Report.Sheets(i).Name
  if sheet_name = "A1" or sheet_name = "B1" or sheet_name = "R1" then
  else
    msg = msg & "Sheet deleted: " & sheet_name & vbCrLf
    Report.Sheets.Remove(sheet_name)  
  end if
next
print(msg)

 

I hope it helps to avoid the GDI+ error. Good luck with it :-).


0 Kudos
Message 2 of 2
(453 Views)