tartopwaro
07-31-2013, 10:43 PM
Hello :-)
I am actually struggling with a macro which doesn't seem to work :banghead:
Could you please look at my code and maybe help me ?
The error code is the error 91
it happens from the debug.print line
and I guess it's LinkFormat.SourceFullName which has a bug
I dunnooooooo ouahh
the macro :
Find broken links on a word file and list them in a Csv file.
the code :
Sub Deadlink()
Dim Doc As Document
Dim img As InlineShape
Dim docwimg As Document
'Affect object
Set docwimg = ActiveDocument
Set cvslist = Documents.Add
'For Each img
For Each img In docwimg.InlineShapes
'Control
Debug.Print "Image : " & img.LinkFormat.SourceFullName & " -- " & Dir(img.LinkFormat.SourceFullName)
'Test
If Dir(img.LinkFormat.SourceFullName) = "" Then
'Écriture dans le document si image non présente
cvslist.Range.Select
Selection.Collapse (wdCollapseEnd)
Selection.TypeText img.LinkFormat.SourceFullName & vbCrLf
End If
Next img
'Save
cvslist.SaveAs2 "C:\Temp\error_report.csv", wdFormatDOSText
'Close
cvslist.Close
Set cvslist = Nothing
End Sub
Any idea ? : pray2: Oh, I'm on Office 2010!
I am actually struggling with a macro which doesn't seem to work :banghead:
Could you please look at my code and maybe help me ?
The error code is the error 91
it happens from the debug.print line
and I guess it's LinkFormat.SourceFullName which has a bug
I dunnooooooo ouahh
the macro :
Find broken links on a word file and list them in a Csv file.
the code :
Sub Deadlink()
Dim Doc As Document
Dim img As InlineShape
Dim docwimg As Document
'Affect object
Set docwimg = ActiveDocument
Set cvslist = Documents.Add
'For Each img
For Each img In docwimg.InlineShapes
'Control
Debug.Print "Image : " & img.LinkFormat.SourceFullName & " -- " & Dir(img.LinkFormat.SourceFullName)
'Test
If Dir(img.LinkFormat.SourceFullName) = "" Then
'Écriture dans le document si image non présente
cvslist.Range.Select
Selection.Collapse (wdCollapseEnd)
Selection.TypeText img.LinkFormat.SourceFullName & vbCrLf
End If
Next img
'Save
cvslist.SaveAs2 "C:\Temp\error_report.csv", wdFormatDOSText
'Close
cvslist.Close
Set cvslist = Nothing
End Sub
Any idea ? : pray2: Oh, I'm on Office 2010!