Ceci est une page optimisée pour les mobiles. Cliquez sur ce texte pour afficher la vraie page.

XL 2021 Récupérer la latitude et longitude de sa position actuelle

Nicolas JACQUIN

XLDnaute Impliqué
Supporter XLD
Bonjour à tous,

Je cherche à récupérer automatiquement ma position, longitude,latitude et ville, à l'ouverture du classeur,
pour les placer en variable et les intégrer dans mon programme

J'ai essayé avec "https://www.google.fr/maps/place/" mais je connais pas
J'ai trouvé des choses en rentrant la ville mais c'est pas ça que je souhaite

Merci d'avance à tous

Nicolas
 
Dernière édition:

Nicolas JACQUIN

XLDnaute Impliqué
Supporter XLD
Comme je disais : dans mon cas ce sont 90 km de décalage.
Perso, je ne trouve pas que ce soit "pas grand chose".

Comme quoi, une fois de plus, on ne voit pas les choses de la même façon.

Re, je viens de faire l'essaie avec mon beau frère à 3 km de chez moi ( communne hennebont comme moi ), il est situé sur le prog à Lorient ( environ une bonne 20 ènes de kilomètres ) je sèche là
 

Nicolas JACQUIN

XLDnaute Impliqué
Supporter XLD
Avec le fichier du post # 37 je peux lire l'ensoleillement mais j'ai plus de soleil maintenant c'est malin le temps est tout gris !!!


Regarde la pièce jointe 1202843

Par contre la localisation est identique à celle de mon post # 34

VB:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim I
Dim Interval
Dim texte
Dim HZenith As String
Dim EnsolPréc As Date
Dim EnsolJour As Date

If Target.Count > 1 Then Exit Sub
If Intersect(Target, Range("Calendrier")) Is Nothing Then Exit Sub
If Not IsNumeric(Left(Target, 1)) Or Target = "" Then Exit Sub

With Forme

.Hauteur_basse_mer_am = "": .Hauteur_pleine_mer_am = "": .Hauteur_basse_mer_ap = "": .Hauteur_pleine_mer_ap = ""

.Lbl_MaréeJour = "": .Lbl_MaréeJour.ForeColor = -2147483630

A = Year(Range("B1")): M = Month(Range("B1")): j = Left(Target, Len(Target) - InStr(Target, " ") + 1)
vdate = DateSerial(A, M, j)

fete (vdate)
Mareee (vdate)

With Sheets("Lune").ListObjects("t_Lune")
For I = 1 To .ListRows.Count
Interval = DateDiff("d", vdate, .DataBodyRange(I, 2))
Debug.Print Interval
If Interval > 1 Then
texte = Hour(.DataBodyRange(I, 3)) & " h " & Minute(.DataBodyRange(I, 3)) & " min " & "dans " & Interval & " jours"
Forme.Label86.Caption = "( par rapport à la date sélectée )"
ElseIf Interval = 1 Then
texte = Hour(.DataBodyRange(I, 3)) & " h " & Minute(.DataBodyRange(I, 3)) & " min " & "demain"
Forme.Label86.Caption = "( par rapport à la date sélectée )"
ElseIf Interval = 0 Then
texte = Hour(.DataBodyRange(I, 3)) & " h " & Minute(.DataBodyRange(I, 3)) & " min "
Forme.Label86.Caption = "( par rapport à la date sélectée )"
End If

If Interval >= 0 Then
Select Case Asc(.DataBodyRange(I, 1))
Case 153
'Range("D17") = "Pleine Lune à " & Texte
Forme.Lbl_NextLune = "Pleine Lune à " & texte

Case 130
'Range("D17") = "Premier Quartier à " & Texte
Forme.Lbl_NextLune = "Premier Quartier à " & texte

Case 152
'Range("D17") = "Nouvelle Lune à " & Texte
Forme.Lbl_NextLune = "Nouvelle Lune à " & texte

Case 131
'Range("D17") = "Dernier Quartier à " & Texte
Forme.Lbl_NextLune = "Dernier Quartier à " & texte

End Select
Exit For
End If
Next I
''''''''''''''''''''''''''''''''''''''''''''''''''''
End With

'.Lbl_Jour.Caption = IIf(vdate = Date, WorksheetFunction.Proper(Format(vdate, "dddd")) & " " & Format(vdate, "dd mmmm yyyy") & " " & _
'"(aujourd'hui)", WorksheetFunction.Proper(Format(vdate, "dddd")) & " " & Format(vdate, "dd mmmm yyyy"))
.Lbl_Jour.Caption = WorksheetFunction.Proper(Format(vdate, "dddd")) & " " & Format(vdate, "dd mmmm yyyy")

.Lbl_NumSem.Caption = "Semaine n° " & DatePart("ww", vdate, vbMonday, vbFirstFourDays)
.Dates = vdate ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
.VILLES = "Hennebont"
.Lbl_PosJour.Caption = DatePart("y", vdate) & " ème jour de l'année."

DateDebut = vdate: DateFin = CDate("31/12/" & (A))
NbJours = DateDiff("d", DateDebut, DateFin)
.Lbl_NbJourRestant.Caption = NbJours & " jours restant."

.Lbl_NvlLune.Caption = Worksheets("Lune").ListObjects("t_Lune").DataBodyRange(1, 2)
.Lbl_PreQu.Caption = Worksheets("Lune").ListObjects("t_Lune").DataBodyRange(2, 2)
.Lbl_PleineLune.Caption = Worksheets("Lune").ListObjects("t_Lune").DataBodyRange(3, 2)
.Lbl_DernierQuartier.Caption = Worksheets("Lune").ListObjects("t_Lune").DataBodyRange(4, 2)
.Lbl_NvlLune2.Caption = Worksheets("Lune").ListObjects("t_Lune").DataBodyRange(5, 2)

ExtraireLevercoucherDuSoleil (vdate - 1)
EnsolPréc = Ensoleil
ExtraireLevercoucherDuSoleil (vdate)
EnsolJour = Ensoleil

'Forme.Lbl_LeverSoleil = "Lever du soleil" & vbTab & vbTab & LeverTU
Forme.Lbl_LeverSoleil = "Lever du soleil" & vbTab & vbTab & Format(LeverTU, "hh:mm")

'Forme.Lbl_CoucherSoleil = "Coucher du soleil" & vbTab & CoucherTU
Forme.Lbl_CoucherSoleil = "Coucher du soleil" & vbTab & Format(CoucherTU, "hh:mm")

'Forme.Lbl_Ensoleillement = "Ensoleillement " & vbTab & vbTab & EnsolJour
Forme.Lbl_Ensoleillement = "Ensoleillement" & vbTab & Format(EnsolJour, "hh:mm")

Forme.dif_ensoleil = "(" & IIf(EnsolPréc > EnsolJour, "-", "+") & Format(Minute(EnsolPréc - EnsolJour), "0") & " min)"

HZenith = Format(ZenithTime(vdate, 3.36667), "hh:mm:ss")
'Forme.Lbl_Zenith = "Zenith " & vbTab & vbTab & vbTab & HZenith
Forme.Lbl_Zenith = "Zenith" & vbTab & vbTab & vbTab & Format(HZenith, "hh:mm")
Forme.requête

Call JoursRestantsAvantProchaineSaison

End With
End Sub

Remplace par ça pour voir
Nico
 

vgendron

XLDnaute Barbatruc
si finalement, tu te décides à inscrire ton adresse
une api gratuite.. du gouvernement
voir explication ici

et mise en application dans ton fichier
 

Pièces jointes

  • New Calendrier v2.xlsm
    217.8 KB · Affichages: 1

Nicolas JACQUIN

XLDnaute Impliqué
Supporter XLD
si finalement, tu te décides à inscrire ton adresse
une api gratuite.. du gouvernement
voir explication ici

et mise en application dans ton fichier

Re, je pense pas que tu es compris ma demande,
Moi je veux récupérer les coordonnées latitude et longitude sans connaitre l'adresse de l'utilisateur, ça serait trop simple sinon , le but est à n'importe quel utilisateur de retrouver sa ville affiché directement sans rien demander
 

Discussions similaires

Les cookies sont requis pour utiliser ce site. Vous devez les accepter pour continuer à utiliser le site. En savoir plus…