i have a macro that pulls data from a spreadsheet and writes a google earth KML file...it was working fine until IT decided that instead of installing Access 2007 on my machine, they updated my full office suite and my macro no longer works.
the original spreadsheet is 270k lines and i'm not a fan of using spreadsheets as databases, so this will eventually get moved to access (thus the request to install access) but i'm under the gun to produce some map files for some of the data now. i don't have a machine available to me with excel 2007 to just run the macro i have...so i need to fix the macro quickly.
obviously, there is much more to the macro, but the line that i'm failing on is the "for each cell in [Data!"... I get an error "object required" which tells me that 2010 is handling the sheet names differently and I have to define the sheet as an object, and possibly even the range as an object as well?
I have to do something with the worksheet names in 2010...i've tried just using activesheet to no avail...i can't quite get the syntax right. Thanks in advance for any help you may be able to lend here.
the original spreadsheet is 270k lines and i'm not a fan of using spreadsheets as databases, so this will eventually get moved to access (thus the request to install access) but i'm under the gun to produce some map files for some of the data now. i don't have a machine available to me with excel 2007 to just run the macro i have...so i need to fix the macro quickly.
Code:
Sub generateFullKML()
'
'Generate KML Macro
'Written by Jason Basham
'For internal use only by Windstream Communications Employees
'Not for use by the technically inept.
'dim variables
Dim pm_name$, pm_addr_st$, pm_addr_2$, pm_city$, pm_state$, pm_zip$, pm_acctNum$, pm_facClass$, pm_parentAcctNum$, pm_renewDate$, pm_contactName$, pm_contactNum$, pm_expDate$, pm_term$, pm_autoRenew$, pm_facEqv$
Dim pm_dyIP As Double
Dim pm_revenue As Long
Dim pm_lat$, pm_lon$
Dim cell As Range
Dim i As Long
Dim pm_style As String
Dim user_filenm As String
i = 0
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
'establish filepath and open document for writing
user_filenm = InputBox("Please enter a filename without drive letter or path", "INPUT FILENAME")
If user_filenm = "" Then
End
Else
'filepath = "C:\MyMap.kml"
filepath = "C:\zzzMapItProj_" & user_filenm & ".kml"
End If
Open filepath For Output As #1
'write header to file and create StyleMap for KML output.
outputHeader
'loop through rows of data
For Each cell In [Data!a5:a279999]
If cell.EntireRow.Hidden = False Then
pm_name = cell.Offset(0, 6)
obviously, there is much more to the macro, but the line that i'm failing on is the "for each cell in [Data!"... I get an error "object required" which tells me that 2010 is handling the sheet names differently and I have to define the sheet as an object, and possibly even the range as an object as well?
I have to do something with the worksheet names in 2010...i've tried just using activesheet to no avail...i can't quite get the syntax right. Thanks in advance for any help you may be able to lend here.
Last edited: