ActiveCell.Value = "" & DocName
Option Explicit Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim colonne, ligne As Integer colonne = Target.Column ligne = Target.Row 'MsgBox colonne 'MsgBox ligne Range("Q" & ligne).Value = "azerty" Cells(ligne, colonne).Value = "azerty" End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionOption Explicit Dim mavariable, cheminfichier As String Private Sub CommandButton1_Click() mavariable = "essai" ecriture 'Déclaration des variables Dim appExcel As Excel.Application 'Application Excel Dim wbExcel As Excel.Workbook 'Classeur Excel Dim wsExcel As Excel.Worksheet 'Feuille Excel 'Ouverture de l'application Set appExcel = CreateObject("Excel.Application") appExcel.Visible = True 'Ouverture d'un fichier Excel Set wbExcel = appExcel.Workbooks.Open(ThisDocument.Path & "\essai.xls") 'wsExcel correspond à la première feuille du fichier Set wsExcel = wbExcel.Worksheets(1) Range("A1").Select appExcel.Quit End Sub Sub ecriture() Dim intFic As Integer intFic = FreeFile SetAttr ThisDocument.Path & "\essai.txt", vbNormal 'fichier normal pour écrire cheminfichier = ThisDocument.Path & "\" Open cheminfichier & "essai.txt" For Output As intFic Print #intFic, mavariable Close intFic End Sub
Option Explicit Sub lecture() Dim intFic As Integer Dim strLigne As String Dim cheminfichier As String intFic = FreeFile SetAttr ThisWorkbook.Path & "\essai.txt", vbNormal 'fichier normal pour lire cheminfichier = ThisWorkbook.Path & "\" Open cheminfichier & "essai.txt" For Input As intFic While Not EOF(intFic) Line Input #intFic, strLigne mavariable = strLigne Wend Close intFic End Sub Private Sub Workbook_Open() lecture End Sub
Option Explicit Public mavariable As String
Option Explicit Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim colonne, ligne As Integer colonne = Target.Column ligne = Target.Row Range("Q" & ligne).Value = mavariable 'auchoix Cells(ligne, colonne).Value = mavariable 'auchoix End Sub
docname = "c'est simple, non ?" ' juste pour simuler. Toi, tu supprime cette ligne (docname a déjà du texte)
Dim ma_donnee_a_passer As New MSForms.DataObject
ma_donnee_a_passer.SetText docname
ma_donnee_a_passer.PutInClipboard
Il est donc connu à la fin de l'exécution de ma macro publipostage
et transforme la valeur contenue dans la cellule n° dossier traité en lien hypertexte vers une fiche word
Ce numéro de dossier est donc connu du rédacteur ?
en prenant juste soin de sélectionner la bonne ligne pour etre sur de prendre le bon dossier