Hi,
We are converting many excel macros to calc macros. We are using the Option VBA support 1 command so we do not have to convert each line of all macros.
Some VBA commands work well and we only have to worry about (convert) the other commands.
Sometimes, the coding that normally work well don't work and gives an error. (Basic run time error 1 - Type: com.sun.star.uno.RuntimeException
Message: unsatisfied query for interface of type com.sun.star.container.XNameAccess!)
However, if we save the file, close it and open it again, the same coding works without any problem for some time. This repeats and we have to save, close and open again many times working with the same file.
Is there a way to get this sorted?
Really appreciate your support.
Sulochana
Inconsistent VBA support in calc
Inconsistent VBA support in calc
OpenOffice 3.1 on Windows 7
Re: Inconsistent VBA support in calc
you must be more specific. Show some of the code where this fails. Does it still fail with a newer version of AOO or LO?
The error means that a particular object does not support the XNameAccess interface, and something is trying to access that interface on an object.
The error means that a particular object does not support the XNameAccess interface, and something is trying to access that interface on an object.
Re: Inconsistent VBA support in calc
Dear Andrew,
Please see the attached error message which also shows the code that gives the error. (It's a simple "Range("N1001").select")
The original file that gives the error is too big to be attached (1.26MB). There is another file which used with this which is about 1MB.
There are many macro's in the file. With further testing during the last 2 days we realized a couple of things.
1. These macros normally work well.
2. This error occurs if a particular macro is run before the macro gives the error. That probably means that the first macro does something that makes the other macros don't work. However, if we save the file close it and open it again, it works without any problem.
I can email the original files to you with specific macro names if required.
Really appreciate your support.
Sulochana
Please see the attached error message which also shows the code that gives the error. (It's a simple "Range("N1001").select")
The original file that gives the error is too big to be attached (1.26MB). There is another file which used with this which is about 1MB.
There are many macro's in the file. With further testing during the last 2 days we realized a couple of things.
1. These macros normally work well.
2. This error occurs if a particular macro is run before the macro gives the error. That probably means that the first macro does something that makes the other macros don't work. However, if we save the file close it and open it again, it works without any problem.
I can email the original files to you with specific macro names if required.
Really appreciate your support.
Sulochana
OpenOffice 3.1 on Windows 7
Re: Inconsistent VBA support in calc
Range("A1:X99") is ambiguous and in this situation VBA assumes ActiveSheet.Range("A1:X99"). This is a very serious flaw in VBA which destroyed many documents operating on the active sheet when the wrong sheet was the active one.
This is a good occasion to pay a qualified programmer for the conversion into something more serious than VBA (which might NOT be Calc/StarBasic).
This is a good occasion to pay a qualified programmer for the conversion into something more serious than VBA (which might NOT be Calc/StarBasic).
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
- Posts: 56
- Joined: Wed Aug 12, 2009 1:14 pm
- Location: London, UK
Re: Inconsistent VBA support in calc
Don't know anything about Option VBA support 1 command and what that enables you to do. The usual way of accessing a cell range in AOO Basic would be something like
Code: Select all
Doc = ThisComponent
Sheet=Doc.Sheets.getByName("Sheet1")
CellRange = Sheet.getCellRangeByName("A1:C15")
AOO 4.1.10
macOS Big Sur version 11.6.2
macOS Big Sur version 11.6.2
Re: Inconsistent VBA support in calc
Off hand, my best guess as to the problem is that in the course of running the script, the wrong thing becomes active so that the object "sheet" does not reference a sheet, or, the VBA compatible way references something, like say ThisComponent, that is no longer valid.
You have a reference to the object used to "get" the Sheet variable? If so, use that to get the current controller and try the OpenOffice way to select things. Something like
Use the method as shown in the previous post to get the cell range from the sheet. This presumes, of course, that the Sheet object is as expected.
You have a reference to the object used to "get" the Sheet variable? If so, use that to get the current controller and try the OpenOffice way to select things. Something like
Code: Select all
oDoc.CurrentController.Select(CellRange)