摘要:
一、由经纬度计算距离VBA代码:Sub Example02() Dim Distance As Double Dim lat1 As Double Dim lon1 As Double Dim lat2 As Double Dim lon2 As Double '位置1:尧都区华洲路面粉厂 lat1 = 36.07812 lon1 = 111.54295 '位置2:尧都区秦署路党校 lat2 = 36.07436 lon2 = 111.494613 Distance = CalcDistance(l... 阅读全文
摘要:
一、以下代码是通过Auto_Open事件,自动向ThisWorkbook里添加VBA代码:Private Sub Auto_Open() Call AddCodeToThisWorkbook MsgBox ("This is Auto_Open Sub !")End SubPrivate Sub AddCodeToThisWorkbook() With ThisWorkbook.VBProject.VBComponents("ThisWorkbook").CodeModule .InsertLines 1, "Private Sub Workb 阅读全文