This post is a follow up to my previous post Excel to GoogleEarth KML. The Excel
macro in the previous post would export points and their attribute table to Google
Earth.
In this updated version, you can also attach an image at each
of selected points along with the image description if available. This version
does not have any limitations on number of points and number of attributes you
can export (the previous version would not let you have more than 10
attributes). But make sure you do not freeze your computer using 100s of points and attributes :-)
Here is
you use it
Download the file and open in Excel 2007 or later. If the macro security is not set to High, you will be asked to Enable macros. Go ahead
and enable the Macros.
Points:
- Latitude and Longitudes must be in decimal degrees
(see sample data)
- Use negative for Western Longitude and
Southern Latitudes (see sample data)
- Latitude and Longitude must be present and in
columns 2 and 3 for this tool to work.
- You can have any number of attributes for each point
(i.e. columns D onwards) but it is optional and you can 1 or 5 or 10
or no attribute. You can also have different number of attributes for
each locations. These attributes are shown as tables at each locations
(Click on balloon on Google Earth to expand the table)
- You can have as many number of points as needed
- Change title or header (Row 1) of the attributes as
needed
- Values in the First column will be used to display
the name of locations on GoogleEarth window (See sample image)
Image:
- You can add image to be displayed on the balloon at
each point. Click on "Browse Image" button on each row to select the
image you want to display. It will add image path in column next to it.
- You can add caption or description for the image.
This text will be displayed right under the image in GoogleEarth balloon.
(See sample image)
To Open:
- If GoogleEarth is installed on a location different than C:\Program Files (x86)\Google\Google Earth\client\googleearth.exe ,
then the macro will ask you to one time locate the googleearth.exe
manually
Note:
- You must define Point Name, Latitude and Longidute
for each point. Everything else is optional. You can define the attributes
for one and not define for other point. Image, image captions are optional
as well.
Once you export the data, the macro will open it automatically in Google Earth (As long as Google Earth is installed on your computer). Based on the location of Google Earth executable, this tool might ask you to locate the googleearth.exe file for the first time and it will remember the location afterwards)
This is Macro enabled Excel files. The underlying VBA
codes are visible, you are welcome to use the code and the worksheet.
If you find any bug in the code, post it in the comments below I will try to
help you out!!
(Note: An Excel macro in general should not create any
problem with your MS Excel installations and other Add-Ins. If it does, use it
at your own risk)
Cheers!!
Smile and Live Happy!
Smile and Live Happy!
5 comments:
thanks to your post
but what if i need chinese attribute value?
now all i exported are shown in Garbled...
could you teach me how to make it correct?
The application is awesome!! Thank You. I was witting something similar when I found your work.
I have one comment:
After creating the first KMZ file, all format seemed fine except that the image did not show in my balloon!!After a while looking into it, I realize that the link to the image is case sensitive. My .JPG extension was exported as Uppercase!! (this is by default in my camera download software).
Changing the extension to Lowercase solved the problem.
I Modified your code to replace:
imageFileName = Sheets("Hidden").Cells(j, 3).Text
with
imagefilename = LCase(Sheets("Hidden").Cells(j, 3).Text)
To the Sub ExportKML and Voila. it worked...
Thanks Again
Serge Aviles
Serge_Aviles@yahoo.com
竹君子,
Sorry to hear that. You might have figured it out by now.
I think, the problem you are having is because of the VB editor not being able to read Chinese characters. My understanding is that you need Chinese version of Windows for the VB compiler to understand those characters. Please share it here if you have figured it out.
Cheers!!
Sergio Aviles, Glad to be of help!! I appreciate you posting the solution here. I will update the macro and re-post it, sometime soon.
Cheers!!
Hi MP. I appreciate your work this is great.
Thank you for sharing it.
I wanna add that I want to compress it using 7zip for MS dont recognize some characters.
-Ian C.
Post a Comment