Macro vers votre navigateur ....

1 Beitrag

Dieses Thema wurde im Forum Französisch veröffentlicht

Je me permets, (je sais pas si c'est une bonne idée ?)

de vous proposer une macro gratuite (je sais pas si cette autre idée est bonne elle aussi ?) qui pointe depuis Microsoft Excel vers un site (pour l'exemple j'ai pris Delcampe), afin d'arriver direct sur la page de la recherche de la pièce de votre collection depuis le CSV Numista avec un clic droit ...

NOTA : j'ai posé le texte en anglais, vous rectifierez vous-même si vous le souhaitez !

Le chemin de votre navigateur est dans la variable "BrowserPath"

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
    Const BrowserPath = "C:Program Files (x86)Mozilla Firefoxfirefox.exe"
    
    Dim tmp_coin() As String
    Dim tmp_country() As String
    Dim url, url1, url2, url3
    Dim line, the_year, a
    
    
    url1 = "http://coins.delcampe.net/list.php?language=E&searchString=";
    url3 = "&cat=0&searchMode=all&searchTldCountry=net&searchInDescription=N"
    
    line = Target.Row
    While ActiveSheet.Cells(line, 4) = "" Or line < 2
        line = line - 1
    Wend
    
    If line < 4 Then
        MsgBox "Code error"
        Exit Sub
    Else
        tmp_coin = Split(ActiveSheet.Cells(line, 4), " ")
        
        While ActiveSheet.Cells(line, 1) = "" Or line < 4
            line = line - 1
        Wend
        
        tmp_country = Split(ActiveSheet.Cells(line, 1), " ")
    End If

    If IsNumeric(tmp_coin(0)) Then tmp_coin(0) = CStr(tmp_coin(0))
    If IsNumeric(tmp_coin(1)) Then tmp_coin(1) = CStr(tmp_coin(1))
    
    the_year = ActiveSheet.Cells(Target.Row, 5)
    If IsNumeric(the_year) Then the_year = CStr(the_year)
    
    url2 = tmp_coin(0) & "+" & tmp_coin(1) & "+" & tmp_country(0) & "+" & the_year
    url2 = Replace(url2, " ", "+")
    url2 = Replace(url2, "-", "+")
    
    url2 = Replace(url2, "é", "e")
    url2 = Replace(url2, "è", "e")
        
    url = url1 & url2 & url3
    
    a = MsgBox("would you like to open search on 'Delcampe' web site for this coin ?" + vbCrLf + url, vbYesNo)
    If a = vbYes Then
        Shell BrowserPath + " " + url
        Cancel = True
    Else
        Cancel = False
    End If
End Sub

» Forumsregeln

Die verwendete Zeitzone ist UTC+2:00.
Die aktuelle Zeit ist 18:38.