Variable de bloc with non definie

Bonjour,

J'ai insérer le code :

Public Sub CommandButton_Click()

    Dim nom As String
    Dim fichier As String

    fichier = "SurvTravRadiopro"
    ChDir "C:\Users\raditran\Desktop\SuiviPersonnels\"
    nom = fichier & "_" & Year(Date) & Month(Date) & Day(Date) & ".xlsm"
    ThisWorkbook.SaveAs (nom)

    Set scrHst = CreateObject("WScript.Shell")
        emplacement = scrHst.SpecialFolders("Desktop")

    Dim Raccourci As Object
        With CreateObject("WScript.Shell")
        Set Raccourci = .CreateShortcut(.SpecialFolders("Desktop") & "\" & _
                    ActiveWorkbook.Name & ".lnk")
        End With
            Raccourci.TargetPath = ActiveWorkbook.FullName
            Raccourci.Save
            SetRaccourci = Nothing

End Sub

Qui me renvoi systématiquement le message :

image Alors que la macro semble fonctionner normalement !
Je ne comprends pas mon erreur,

Quelqu'un y voit plus clair que moi svp ?

Merci par avance aux contributeurs

Dilettante

Re,

Pour ceux que le code interesserait il fonctionne très bien à condition de respecter les espaces :

SetRaccourci = Nothing

Après avoir lu et relu...... pffff

Je passe en résolu

Dilettante

Rechercher des sujets similaires à "variable bloc definie"