mabentwickeltsich / MendeleyMacros

New functionalities for Mendeley's plugin: hyperlinks for citations pointing to bibliography, hyperlinks for URLs in bibliography, and fix to maintain Microsoft Word style of bibliography.
41 stars 25 forks source link

String parameter too long. #18

Open frijheid opened 2 months ago

frijheid commented 2 months ago

Thank you for creating such a useful macro. but I encountered an error when the url was too long. This can be solved by modifying the URL, but sometimes the bibliography URL has to be long. I request that improvements be made to this section. thank you very much.

Run-time error '5854': String parameter too long. pada .text = strURL

in the block of

                                'finds and selects the text of the URL
                                With Selection.Find
                                    .Forward = True
                                    .Wrap = wdFindStop
                                    .text = strURL
                                    .Execute
                                    blnURLFound = .found
                                End With
frijheid commented 2 months ago

I found the solution by adding the ccut url function before the block to find selects the text. However, this makes the related libbiography imperfect.

                                    ' Cut URL
                                    If Len(strURL) > 255 Then
                                        Debug.Print "Referensi #" & debugCounter & " memiliki URL terlalu panjang:"
                                        Debug.Print "URL: " & strURL
                                        Debug.Print "Panjang: " & Len(strURL) & " karakter"
                                        Debug.Print "---"

                                        strURL = Left(strURL, 255)
                                        debugCounter = debugCounter + 1
                                    End If