Je soutiens Excel Downloads
Connexion
S'inscrire
Effectuez une recherche sur Excel Downloads...
Effectuez une recherche sur Excel Downloads...
Rechercher dans les titres uniquement
Par:
FORUMS
Nouveaux messages
Rechercher dans les forums
TÉLÉCHARGEMENTS
POUR LES PROFESSIONNELS
Gestion commerciale
Gestion de projets
Gestion du personnel
Tableaux de bord
Comptabilité
Immobilier
Bourse
POUR LES PARTICULIERS
Budgets et comptes
Plannings et calendriers
UTILITAIRES
LEÇONS ET TUTORIAUX
Fonctions Excel
Vba
RESSOURCES PEDAGOGIQUES
Rechercher une ressource
ACTUALITÉS
TUTOS
EXCEL
FORMULES ET FONCTIONS
VBA
POWER QUERY
POWER PIVOT
POWER BI
AUTRES APPLICATIONS
Recherche de tutos vidéos
Connexion
S'inscrire
Quoi de neuf
Effectuez une recherche sur Excel Downloads...
Effectuez une recherche sur Excel Downloads...
Rechercher dans les titres uniquement
Par:
Nouveaux messages
Rechercher dans les forums
Menu
Connexion
S'inscrire
Installer l'application
Installer
FORUMS
Questions
Autres applications
Débogage d'une ligne de code
JavaScript est désactivé. Pour une meilleure expérience, veuillez activer JavaScript dans votre navigateur avant de continuer.
Vous utilisez un navigateur obsolète. Il se peut que ce site ou d'autres sites Web ne s'affichent pas correctement.
Vous devez le mettre à jour ou utiliser un
navigateur alternatif
.
Répondre à la discussion
Message
<blockquote data-quote="marine_volria" data-source="post: 20454339" data-attributes="member: 355853"><p>Bonjour,</p><p></p><p>Pourriez vous me dire pourquoi j'ai un bug sur la ligne 141 """"""shortsn = Left(strTEMP, InStr(strTEMP, "-") - 1)"""""" on me dit argument ou appel de procédure incorrect je comprends pas trop pourquoi.</p><p></p><p>Merci d'avance pour votre aide.</p><p> </p><p>[CODE]Sub Docx_en_P_pdf()</p><p> ActiveDocument.Save</p><p> 'sauvegarde doc</p><p> </p><p> path1 = ActiveDocument.Path</p><p> FileName = ActiveDocument.Name</p><p> 'Chemin prendre doc actif</p><p> 'Nom du doc prendre le doc actif</p><p> </p><p> FileName = Left(FileName, Len(FileName) - 5)</p><p> </p><p> ChangeFileOpenDirectory path1 & "\"</p><p> ActiveDocument.SaveAs2 FileName:=FileName & ".docx", _</p><p> FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", _</p><p> AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, _</p><p> EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData _</p><p> :=False, SaveAsAOCELetter:=False, CompatibilityMode:=15</p><p> 'prendre le docx</p><p> </p><p> </p><p> ActiveDocument.ExportAsFixedFormat OutputFileName:= _</p><p> path1 & "\" & FileName & "-P.pdf", ExportFormat:=wdExportFormatPDF, _</p><p> OpenAfterExport:=False, OptimizeFor:=wdExportOptimizeForPrint, Range:= _</p><p> wdExportAllDocument, From:=1, To:=1, Item:=wdExportDocumentContent, _</p><p> IncludeDocProps:=True, KeepIRM:=True, CreateBookmarks:= _</p><p> wdExportCreateNoBookmarks, DocStructureTags:=True, BitmapMissingFonts:= _</p><p> True, UseISO19005_1:=False</p><p> 'transformer en -P.pdf</p><p> </p><p> ActiveDocument.Save</p><p> ' sauvegarder le docuement actif</p><p></p><p></p><p>End Sub</p><p>Sub Docx_en_R0_docx()</p><p> ActiveDocument.Save</p><p> </p><p> path1 = ActiveDocument.Path</p><p> FileName = ActiveDocument.Name</p><p> </p><p> FileName = Left(FileName, Len(FileName) - 5)</p><p> </p><p> ChangeFileOpenDirectory path1 & "\"</p><p> ActiveDocument.SaveAs2 FileName:=FileName & ".docx", _</p><p> FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", _</p><p> AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, _</p><p> EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData _</p><p> :=False, SaveAsAOCELetter:=False, CompatibilityMode:=15</p><p> </p><p> ActiveDocument.ExportAsFixedFormat OutputFileName:= _</p><p> path1 & "\" & FileName & "-R0.docx", ExportFormat:=wdExportFormatPDF, _</p><p> OpenAfterExport:=False, OptimizeFor:=wdExportOptimizeForPrint, Range:= _</p><p> wdExportAllDocument, From:=1, To:=1, Item:=wdExportDocumentContent, _</p><p> IncludeDocProps:=True, KeepIRM:=True, CreateBookmarks:= _</p><p> wdExportCreateNoBookmarks, DocStructureTags:=True, BitmapMissingFonts:= _</p><p> True, UseISO19005_1:=False</p><p> </p><p> ActiveDocument.Save</p><p></p><p></p><p>End Sub</p><p>Sub insérerfilename()</p><p></p><p> Selection.InsertBefore Text:=Left(ActiveDocument.Name, _</p><p> Len(ActiveDocument.Name) - 5)</p><p></p><p>End Sub</p><p></p><p>Sub Pied_de_page_auto()</p><p></p><p> If ActiveWindow.View.SplitSpecial <> wdPaneNone Then</p><p> ActiveWindow.Panes(2).Close</p><p> End If</p><p> If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _</p><p> ActivePane.View.Type = wdOutlineView Then</p><p> ActiveWindow.ActivePane.View.Type = wdPrintView</p><p> End If</p><p> ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter</p><p> Selection.TypeBackspace</p><p> Selection.HomeKey Unit:=wdLine</p><p>End Sub</p><p>Sub Insertion_date_auto()</p><p></p><p> If ActiveWindow.View.SplitSpecial <> wdPaneNone Then</p><p> ActiveWindow.Panes(2).Close</p><p> End If</p><p> If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _</p><p> ActivePane.View.Type = wdOutlineView Then</p><p> ActiveWindow.ActivePane.View.Type = wdPrintView</p><p> End If</p><p> ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter</p><p> Selection.InsertDateTime DateTimeFormat:="dddd d MMMM yyyy", InsertAsField _</p><p> :=True, DateLanguage:=wdFrench, CalendarType:=wdCalendarWestern, _</p><p> InsertAsFullWidth:=False</p><p>End Sub</p><p></p><p>Sub Rapports_automatiques_génération_Par_appel()</p><p>'Macro d'éxécution générale</p><p></p><p>Docx_en_P_pdf</p><p>Docx_en_R0_docx</p><p>insérerfilename</p><p>Pied_de_page_auto</p><p>Insertion_date_auto</p><p></p><p></p><p>End Sub</p><p></p><p>Function IsNumeric1(LeMot As String)</p><p> Dim i As Integer</p><p> i = Len(LeMot)</p><p> Dim test As Boolean</p><p> test = True</p><p> </p><p>' chh = Asc(Mid(LeMot, i))</p><p> While i <> 0 And test</p><p> test = Asc(Mid(LeMot, i)) > 47 And Asc(Mid(LeMot, i)) < 58</p><p> i = i - 1</p><p> Wend</p><p> </p><p> IsNumeric1 = (i = 0)</p><p>' With ActiveDocument.Range(Start:=deb, End:=fin) 'emplacement du signet</p><p> ' .Bookmarks.Add Name:=Nom 'ajoute le signet</p><p> ' End With</p><p>End Function</p><p></p><p></p><p>Sub filen()</p><p> 'ggggf parts = Split(Inputfolder, "\")</p><p> ' a = parts(UBound(parts()))</p><p> ' MsgBox ("File is: " & a)</p><p> Dim strFileName As String</p><p> Dim strTEMP As String</p><p> Dim shortsn As String</p><p> Dim longsn As String</p><p> Dim dateinter As String</p><p> Dim dateinterlabel As String</p><p> </p><p> strFileName = ThisDocument.Name</p><p> strTEMP = Right(strFileName, Len(strFileName) - InStr(strFileName, "-"))</p><p> shortsn = Left(strTEMP, InStr(strTEMP, "-") - 1)</p><p> strTEMP = Right(strTEMP, Len(strTEMP) - InStr(strTEMP, "-"))</p><p> longsn = Left(strTEMP, InStr(strTEMP, "-") - 1)</p><p> strTEMP = Left(strTEMP, InStrRev(strTEMP, ".") - 1)</p><p> dateinter = Right(strTEMP, Len(strTEMP) - InStrRev(strTEMP, "-"))</p><p> While Len(dateinter) <> 6 Or Not (IsNumeric1(dateinter))</p><p> strTEMP = Left(strTEMP, Len(strTEMP) - Len(dateinter) - 1)</p><p> dateinter = Right(strTEMP, Len(strTEMP) - InStrRev(strTEMP, "-"))</p><p> </p><p> Wend</p><p> yearinter = Left(dateinter, 2)</p><p> dayinter = Right(dateinter, 2)</p><p> monthinter = Right(Left(dateinter, 4), 2)</p><p> dateinterlabel = Format(CDate(dayinter & "/" & monthinter & "/" & yearinter), "dddd d mmmm yyyy")</p><p> TextBox1.Font.Size = 10</p><p> TextBox2.Font.Size = 10</p><p> TextBox3.Font.Size = 10</p><p> TextBox3.Text = dateinterlabel</p><p> TextBox2.Text = longsn</p><p> TextBox1.Text = shortsn</p><p> </p><p>' TextBox1000.Font.Size = 10</p><p> </p><p> </p><p> ' TextBox1016.Font.Size = 7</p><p> ' TextBox1018.Font.Size = 7</p><p> ' TextBox1020.Font.Size = 7</p><p> </p><p>' TextBox1017.Font.Size = 8</p><p> ' TextBox1019.Font.Size = 8</p><p> ' TextBox1021.Font.Size = 8</p><p> </p><p> </p><p>End Sub</p><p></p><p>Private Sub Document_Open()</p><p></p><p>filen</p><p></p><p>End Sub</p><p></p><p></p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="marine_volria, post: 20454339, member: 355853"] Bonjour, Pourriez vous me dire pourquoi j'ai un bug sur la ligne 141 """"""shortsn = Left(strTEMP, InStr(strTEMP, "-") - 1)"""""" on me dit argument ou appel de procédure incorrect je comprends pas trop pourquoi. Merci d'avance pour votre aide. [CODE]Sub Docx_en_P_pdf() ActiveDocument.Save 'sauvegarde doc path1 = ActiveDocument.Path FileName = ActiveDocument.Name 'Chemin prendre doc actif 'Nom du doc prendre le doc actif FileName = Left(FileName, Len(FileName) - 5) ChangeFileOpenDirectory path1 & "\" ActiveDocument.SaveAs2 FileName:=FileName & ".docx", _ FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", _ AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, _ EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData _ :=False, SaveAsAOCELetter:=False, CompatibilityMode:=15 'prendre le docx ActiveDocument.ExportAsFixedFormat OutputFileName:= _ path1 & "\" & FileName & "-P.pdf", ExportFormat:=wdExportFormatPDF, _ OpenAfterExport:=False, OptimizeFor:=wdExportOptimizeForPrint, Range:= _ wdExportAllDocument, From:=1, To:=1, Item:=wdExportDocumentContent, _ IncludeDocProps:=True, KeepIRM:=True, CreateBookmarks:= _ wdExportCreateNoBookmarks, DocStructureTags:=True, BitmapMissingFonts:= _ True, UseISO19005_1:=False 'transformer en -P.pdf ActiveDocument.Save ' sauvegarder le docuement actif End Sub Sub Docx_en_R0_docx() ActiveDocument.Save path1 = ActiveDocument.Path FileName = ActiveDocument.Name FileName = Left(FileName, Len(FileName) - 5) ChangeFileOpenDirectory path1 & "\" ActiveDocument.SaveAs2 FileName:=FileName & ".docx", _ FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", _ AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, _ EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData _ :=False, SaveAsAOCELetter:=False, CompatibilityMode:=15 ActiveDocument.ExportAsFixedFormat OutputFileName:= _ path1 & "\" & FileName & "-R0.docx", ExportFormat:=wdExportFormatPDF, _ OpenAfterExport:=False, OptimizeFor:=wdExportOptimizeForPrint, Range:= _ wdExportAllDocument, From:=1, To:=1, Item:=wdExportDocumentContent, _ IncludeDocProps:=True, KeepIRM:=True, CreateBookmarks:= _ wdExportCreateNoBookmarks, DocStructureTags:=True, BitmapMissingFonts:= _ True, UseISO19005_1:=False ActiveDocument.Save End Sub Sub insérerfilename() Selection.InsertBefore Text:=Left(ActiveDocument.Name, _ Len(ActiveDocument.Name) - 5) End Sub Sub Pied_de_page_auto() If ActiveWindow.View.SplitSpecial <> wdPaneNone Then ActiveWindow.Panes(2).Close End If If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _ ActivePane.View.Type = wdOutlineView Then ActiveWindow.ActivePane.View.Type = wdPrintView End If ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter Selection.TypeBackspace Selection.HomeKey Unit:=wdLine End Sub Sub Insertion_date_auto() If ActiveWindow.View.SplitSpecial <> wdPaneNone Then ActiveWindow.Panes(2).Close End If If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _ ActivePane.View.Type = wdOutlineView Then ActiveWindow.ActivePane.View.Type = wdPrintView End If ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter Selection.InsertDateTime DateTimeFormat:="dddd d MMMM yyyy", InsertAsField _ :=True, DateLanguage:=wdFrench, CalendarType:=wdCalendarWestern, _ InsertAsFullWidth:=False End Sub Sub Rapports_automatiques_génération_Par_appel() 'Macro d'éxécution générale Docx_en_P_pdf Docx_en_R0_docx insérerfilename Pied_de_page_auto Insertion_date_auto End Sub Function IsNumeric1(LeMot As String) Dim i As Integer i = Len(LeMot) Dim test As Boolean test = True ' chh = Asc(Mid(LeMot, i)) While i <> 0 And test test = Asc(Mid(LeMot, i)) > 47 And Asc(Mid(LeMot, i)) < 58 i = i - 1 Wend IsNumeric1 = (i = 0) ' With ActiveDocument.Range(Start:=deb, End:=fin) 'emplacement du signet ' .Bookmarks.Add Name:=Nom 'ajoute le signet ' End With End Function Sub filen() 'ggggf parts = Split(Inputfolder, "\") ' a = parts(UBound(parts())) ' MsgBox ("File is: " & a) Dim strFileName As String Dim strTEMP As String Dim shortsn As String Dim longsn As String Dim dateinter As String Dim dateinterlabel As String strFileName = ThisDocument.Name strTEMP = Right(strFileName, Len(strFileName) - InStr(strFileName, "-")) shortsn = Left(strTEMP, InStr(strTEMP, "-") - 1) strTEMP = Right(strTEMP, Len(strTEMP) - InStr(strTEMP, "-")) longsn = Left(strTEMP, InStr(strTEMP, "-") - 1) strTEMP = Left(strTEMP, InStrRev(strTEMP, ".") - 1) dateinter = Right(strTEMP, Len(strTEMP) - InStrRev(strTEMP, "-")) While Len(dateinter) <> 6 Or Not (IsNumeric1(dateinter)) strTEMP = Left(strTEMP, Len(strTEMP) - Len(dateinter) - 1) dateinter = Right(strTEMP, Len(strTEMP) - InStrRev(strTEMP, "-")) Wend yearinter = Left(dateinter, 2) dayinter = Right(dateinter, 2) monthinter = Right(Left(dateinter, 4), 2) dateinterlabel = Format(CDate(dayinter & "/" & monthinter & "/" & yearinter), "dddd d mmmm yyyy") TextBox1.Font.Size = 10 TextBox2.Font.Size = 10 TextBox3.Font.Size = 10 TextBox3.Text = dateinterlabel TextBox2.Text = longsn TextBox1.Text = shortsn ' TextBox1000.Font.Size = 10 ' TextBox1016.Font.Size = 7 ' TextBox1018.Font.Size = 7 ' TextBox1020.Font.Size = 7 ' TextBox1017.Font.Size = 8 ' TextBox1019.Font.Size = 8 ' TextBox1021.Font.Size = 8 End Sub Private Sub Document_Open() filen End Sub [/CODE] [/QUOTE]
Insérer les messages sélectionnés…
Vérification
Répondre
FORUMS
Questions
Autres applications
Débogage d'une ligne de code
Texte copié dans le presse-papier