Can someone think along with me on this one? The module I am working on calls Excell from AutoCAD. Excel does a lot of things, then exports the result to a .txt file, wich is then used to make a drawing.
A sub that I call (using late binding) is causing some problem I can't find a solution to. I should be able to dim a Range with a dimmed "excel.application" (xlapp = Excel.application). But it doesn 't work. I get a compile error: "user defined type not defined" when it runs into the latebound Range I dimmed.
Dim LastrowB As Long
Dim MyRange As xlapp. Range
LastrowB = xlApp.Range("A" & Rows.count).End(xlUp).Row
xlApp.Range("A1", "F" & LastrowB).Select
For Each MyRange In xlApp.Selection
MyRange.Value = Replace(MyRange.Value, ",", ".", , , vbTextCompare)
Next
I tried to get the program to recognise the "range" object like this:
Dim rng As Object
Set rng = CreateObject("Excel.Range")
To no avail, the ActiveX couldn't create the object.
Somehow I can't get it to recognise the Range when I put xlapp. in front of it.
Without it, it works fine. But that will leave Excel running, wich is not an option.
Bookmarks