laanp / NMS-Creature-Builder

NMS Creature Builder
8 stars 1 forks source link

strange EXML error. #3

Open UteJosh opened 1 year ago

UteJosh commented 1 year ago

whenever i select 'load EXML' on the excel form, it gives me an error that says 'Run-time error '-2147483638 (8000000a)':' what should i do to fix this?

laanp commented 1 year ago

I just checked and the program 1.4 should still work. When you get this error, click on "debug" and you should see the VBCode window come up with a yellow highlighted line to show where the error occurred. Can you screenshot that window and send to me?

laanp commented 1 year ago

Also, check if you have the following VBA references checked. Follow the steps below to check:

  1. With your mouse hovered over the "Data" sheet in the workbook, right-mouse click and select "View Code"
  2. In the VBA window, click on the "Tools" menu... "References..." and ensure the same VBA References are checked as shown in the attached image. Save the workbook after making changes, and try the Load EXML again. VBAReferences
UteJosh commented 1 year ago

image heres the screenshot, ill be back in a bit to get the other one.

UteJosh commented 1 year ago

when i go to the data sheet's code, and access tools, references is grayed out.

laanp commented 1 year ago

You need to stop the debugger first... hit the little stop buttun next to the pause button

UteJosh commented 1 year ago

ok i got it

UteJosh commented 1 year ago

they were checked

laanp commented 1 year ago

also, did some research lol (ChatGPT is great)... says your error is an overflow message - something with the way I coded the LoadDocument routine... seems weird, as it works on my machine. Anyways, I have rewritten the routine - just copy and paste this over the routine you have, if you feel comfortable doing that. Otherwise I have update in v1.5 which you can download in a bit.

Public Sub LoadDocument(EXML_Filename As String) ' Routine to load an EXML file and parse it's contents, and then ' lay out the EXML structure on the sheet, based on the passed ' EXML document name.

Dim CurretRow As Long Dim SN_Node As IXMLDOMNode Dim CurrentCol As Long Dim CurrentLevel As Integer Dim elementCount As Long Dim v As Variant

' Check that the passed filename is not blank If EXML_Filename = "" Then MsgBox "No filename found, select a Family CreatureID name" Exit Sub End If

' Disable Screen Processing DisableScreenProcessing

WaitForEXMLForm.Show DoEvents

' create the XML Document Object Model (DOM) Set xDoc = CreateObject("Microsoft.XMLDOM") ' Set validation for parser for well-formed XML only xDoc.validateOnParse = False ' Get the XML file If xDoc.Load(ThisWorkbook.Path & "\EXML\" & EXML_Filename) Then ' The document loaded successfully.

  ' Get the length of XML elements
  elementCount = xDoc.SelectNodes("//*").Length

  ' write xml info to array with exact or assumed items count
  ReDim v(1 To elementCount, 1 To 2)

  ' Get the nodes
  getChildNodes xDoc.DocumentElement, v

  ' Clear the data area
  ClearDataArea

  With NMSData

     ' iterate through the 2-dimensional array
     For r = 1 To UBound(v)

        ' Check for indents over 35
        If v(r, LVLColumn) >= 35 Then
           .Range(ColLetter(Int((v(r, LVLColumn) - 2) / 5) + 1) & r + HeaderRow) = v(r, NAMEColumn)
        Else
           .Range(ColLetter(Int(v(r, LVLColumn) / 5) + 1) & r + HeaderRow) = v(r, NAMEColumn)
        End If

        .Range("A" & r + HeaderRow) = v(r, LVLColumn)

     Next r

  End With

  ' error check that activecell is in family range
  If ActiveCell.Row <= HeaderRow Then
     NMSData.Cells(HeaderRow + 1, NMSData.Range("Family_Rng").Column).Activate
  End If

  ' error check that activecell is in family range
  If ActiveCell.Row > NMSData.Range("Family_Rng").Rows.Count + HeaderRow Then
     NMSData.Cells(HeaderRow + 1, NMSData.Range("Family_Rng").Column).Activate
  End If

  ' Update the currrently loaded info
  NMSData.Range("Curr_Fam_Name_Rng").Value = Cells(ActiveCell.Row, NMSData.Range("Family_Rng").Column).Value

Else ' The document failed to load. MsgBox "EXML file did not load" & vbCrLf & _ "Check if " & EXML_Filename & " exists in the directory!"

End If

Cleanup:

' Hide waiting screen WaitForEXMLForm.Hide

' Set the global variable for last row on sheet SetLastDataRow

' Enable Screen Processing EnableScreenProcessing

' scroll up to top ActiveWindow.ScrollRow = 3

End Sub

UteJosh commented 1 year ago

ok

UteJosh commented 1 year ago

thank you!!

UteJosh commented 1 year ago

i think ill wait for 1.5, as im not familiar with code

UteJosh commented 1 year ago

thanks!!!

UteJosh commented 1 year ago

sorry for the wait, i had little time to test

UteJosh commented 1 year ago

i got the same error. am i misusing it?

UteJosh commented 1 year ago

image

laanp commented 1 year ago

Mmmm... run the debug and screenshot back to me again. I haven't had this error before, you are the first to report. I do not get it on my system with v1.4 or v1.5, so it's a mystery... Can you verify Excel version, Operating System and RAM you currently have?

UteJosh commented 1 year ago

image

UteJosh commented 1 year ago

i dont know how to get my excel version, but i am on windows 11 with 25.8 GB of ram.

UteJosh commented 1 year ago

wait the ram might be wrong

UteJosh commented 1 year ago

8.0 GB of ram

laanp commented 1 year ago

I think it's either your version of Excel and possibly the version of the EXML parser. You can try changing the line: Set xDoc = CreateObject("Microsoft.XMLDOM")

To: Set xDoc = CreateObject("MSXML2.DOMDocument")

Do this by:

  1. Generate the error again by clicking the Load EXML button.
  2. When the error comes up, click on Debug
  3. Click the Stop Debugger button, and then make the changes above in the "LoadDocument" routine. The line should be a few lines above the error line.
  4. Save the workbook, and exit the VBA window
  5. Try the routine again.
UteJosh commented 1 year ago

Thank you!! One question, (i apologize for my foolishness) but where do i find the LoadDocument routine?

UteJosh commented 1 year ago

i found it nvm

UteJosh commented 1 year ago

it happened again. this might be unsolvable.

laanp commented 1 year ago

Well, from here, I would start looking at the version of Excel you have, and the XML Parser. I developed this being compatible with Microsoft Office 365 Excel (Microsoft® Excel® for Microsoft 365 MSO (Version 2305 Build 16.0.16501.20074) 64-bit) Check your version of C:\Windows\System32\msxml6.dll (see my screen shot attached) Here is the update page for this Type Library: https://support.microsoft.com/en-us/topic/description-of-an-update-for-msxml-core-services-6-0-service-pack-2-9b310b5a-3a90-ebc3-e1bd-97b42266b1ef Msxml 6 0

UteJosh commented 1 year ago

believe we've found it

UteJosh commented 1 year ago

image

UteJosh commented 1 year ago

wait hold on

UteJosh commented 1 year ago

dang