UNKNOWN runtime Error 800A03EC

jsimon

New Member
Joined
Mar 27, 2014
Messages
2
Hi,

Basically I have script that collects data from various sources and passes it into a Data Dictionary called DictData; but I’m having trouble writing it back into a spreadsheet.

The keys represent cell references such as A1, C3, D18, etc… and the items are the data I want to populate into the given cell.

In it of if self, the data looks fine and so do the keys, but the dws.Range(mapRef).Value = currCellData call keeps producing an UNKNOWN runtime Error 800A03EC…

I tried using the array variable: currCellRef(indx), that returns for example, A1 (no dbl quotes)

I also tried passing it into a new variable: mapRef, returning the same as above, errors

I even tried adding the chr(34) (or “) to the front and back of the new variable – although it’s now returning “A1” with the dbl quotes, it still errors…

AND tried cstr()... but still receiving the same error


Any ideas?????

Thanks in advance

---------------------------
Set dFSO = CreateObject("Scripting.FileSystemObject")
Set dXL = CreateObject("Excel.Application")
dXL.UserControl = False
dXL.Visible = False
Set dwb = dXL.workbooks.open(fnCaviumImport)
Set dws = dXL.worksheets(1)
dws.Activate


currCellRef = DictData.keys 'Get the keys

For indx = 0 To DictData.Count -1 'Iterate the array



mapRef = cstr(currCellRef(indx))
mapRef = chr(34) & mapRef & chr(34)

If DictData.Exists(currCellRef(indx)) Then
currCellData = DictData.Item(currCellRef(indx))

dws.Range(cstr(mapRef)).Value = currCellData
<-- Error
end If
indx = indx + 1
Next



dwb.Save
dwb.Close
Set dwb = Nothing
dXL.Quit
Set dXL = Nothing


---------------------------

 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hi
Welcome to the board

See if this simple example helps:


Code:
Sub PopulateCells()
Dim dic As Object
Dim ws As Worksheet
Dim vKeys As Variant
Dim lKey As Long

Set ws = Worksheets("Sheet1")
Set dic = CreateObject("Scripting.Dictionary")

' write some values to the dictionary for testing
dic.Add "A1", 2
dic.Add "B3", "Test B3"
dic.Add "C8", 1.2345

' write the values to the worksheet
vKeys = dic.keys
For lKey = 0 To dic.Count - 1
    ws.Range(vKeys(lKey)).Value = dic(vKeys(lKey))
Next lKey

End Sub
 
Upvote 0
Hi,
Thanks... BUT the Dim as Object, Variant, etc... is causing an "expected end of statement"
Perhaps I should have specified, this is VBScript
 
Upvote 0
Remove this line from your code:
Code:
mapRef = chr(34) & mapRef & chr(34)
 
Upvote 0

Forum statistics

Threads
1,225,669
Messages
6,186,348
Members
453,350
Latest member
mjohnston819

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top