10 posts / 0 new
Last post
Shapefile setup error

When I'm setting up the shapefile map in the data editor, I'm getting a Microsoft Visual Basic "run-time error 1004" after I choose the ID column I want in the .dbf file.  The file name doesn't contain any special characters and the file path is not too long.  Any ideas as to what the problem is?  Thanks.

StatSilk's picture

Hi,
Would you be able to click on 'debug' and note the highlighted line of code? (and if possible, the line number located somewhere in the top of the screen). Many thanks,
Frank

Here's the highlighted line of code (line 257):
 ActiveWorkbook.SaveAs Filename:=newFilename2, FileFormat:=xlCSV
       
Thanks!

StatSilk's picture

Hi,
Besides the error number, does it give an error message e.g. "Cannot access file..."? (The fact that the highlighted code is line 257 suggests you are using an older version of StatPlanet Plus, as in the lastest version this is line 259).

The highlighted line suggests it cannot save the data.csv file. A save error can occur if (i) the StatPlanet Data Editor is opened from within a ZIP file, or (ii) the files are in a location without write permission, e.g. in Program Files - in which case you could try copying it to the desktop for example. If you remove the 'web' directory a problem such as this one could also occur, but then the error would be in the line 'ActiveWorkbook.SaveAs Filename:=newFilename3, FileFormat:=xlCSV'
In any case I hope the above might provide the solution.
Best,
Frank

You're right, it is Line 259.  Sorry about that.  I tried moving the data editor and the .dbf file to the my desktop, but I got the same error message:
"Microsoft Office Excel cannot find any data to replace.  Check if your search formatting and criteria are defined correctly.  If you are sure that matching data exists in this workbook, it may be on a protected sheet.  Excel cannot replace data on a protected sheet."
I picked up the shapefile map from the U.S. Census Bureau web site.  I can see the map using Shapefile Viewer, but I'm unable to open the .dbf file even though I have Adobe Flash Player 10.
Any suggestions?  Thanks!
 
 
 

StatSilk's picture

Hi,
Your error message 'cannot find any data to replace' suggests that it is the line 'Selection.PasteSpecial Paste:=xlPasteValues, SkipBlanks:=False' causing the error, which is indeed line 257. Are you sure it is not this line which is highlighted?
When you copied the files to the desktop, did you copy the whole StatPlanet directory? (moving just individual files can cause problems with the macros). 
The error seems to suggest that the ID column may be empty. Could you try another ID column? Sometimes the 'names' column makes a good ID column too. If you wish to edit the DBF, you would need Open Office Calc.
Frank

That's what I did. I didn't think to copy ALL the StatPlanet files to my desktop.  Wasn't thinking about the macros.  Problem solved.  Thanks! 

StatSilk's picture

Great, glad to hear it works now.
Best,
Frank

I have another question now.  I have added the shapefile, imported the data, and saved the data without any problem.  When I run StatPlanet.exe, a Adobe Flash Player message (copied below) appears.  It gives me the option to "Dismiss All" or "Continue."  The StatPlanet window seems to get stuck with the message "Loading . . . " regardless of the option I select.  Do you know what the problem might be?  Thanks for your help.
Here's the message:
RangeError: DataProvider index (0) is not in acceptable range (0 - -1)
 at fl.data::DataProvider/checkIndex()
 at fl.data::DataProvider/getItemAt()
 at content_fla::MainTimeline/getYearRange()
 at content_fla::MainTimeline/loadRegions()
 at content_fla::MainTimeline/loadMap()
 at content_fla::MainTimeline/completeHandler()
 at content_fla::MainTimeline/completeHandlerCSV()
 at flash.events::EventDispatcher/dispatchEventFunction()
 at flash.events::EventDispatcher/dispatchEvent()
 at flash.net::URLLoader/onComplete() 
 
 

StatSilk's picture

Hi,
The first thing that comes to mind is that it cannot find the right map in the 'map' folder (your map files should be named map.dbf and map.shp). Please note that there are two map directories, one in the main directory, and on in the sub-folder 'map'.
Otherwise it could be a problem with the data structure. Did you get this issue with the 'example data'? Please see also the quick start for more details regarding how data should be structured:
http://www.statsilk.com/files/resources/Quick_Start.pdf
Frank

USER LOGIN