
12-10-15, 13:04
|
| Όνομα: Αλεξια Έκδοση λογισμικού Office: Ms-Office 2007 Γλώσσα λογισμικού Office: Ελληνική | | Εγγραφή: 04-02-2013
Μηνύματα: 22
| |
Πρόβλημα σε κώδικα vba
Καλημέρα καλή εβδομάδα
εχω ενα κωδικα που αλλαζει string σε μια λειτουργική μοναδα
Public Function SearchOrReplace(ByVal modulename As String, ByVal StringToFind As String, _
Optional ByVal NewString, Optional ByVal FindWholeWord = False, _
Optional ByVal MatchCase = False, Optional ByVal PatternSearch = False) As Boolean
Dim mdl As Module
Dim lSLine As Long
Dim lELine As Long
Dim lSCol As Long
Dim lECol As Long
Dim sLine As String
Dim lLineLen As Long
Dim lBefore As Long
Dim lAfter As Long
Dim sLeft As String
Dim sRight As String
Dim sNewLine As String
Set mdl = Modules(modulename)
If mdl.Find(StringToFind, lSLine, lSCol, lELine, lECol, FindWholeWord, _
MatchCase, PatternSearch) = True Then
If IsMissing(NewString) = False Then
' Store text of line containing string.
sLine = mdl.Lines(lSLine, Abs(lELine - lSLine) + 1)
' Determine length of line.
lLineLen = Len(sLine)
' Determine number of characters preceding search text.
lBefore = lSCol - 1
' Determine number of characters following search text.
lAfter = lLineLen - CInt(lECol - 1)
' Store characters to left of search text.
sLeft = Left$(sLine, lBefore)
' Store characters to right of search text.
sRight = Right$(sLine, lAfter)
' Construct string with replacement text.
sNewLine = sLeft & NewString & sRight
' Replace original line.
mdl.ReplaceLine lSLine, sNewLine --- σε αυτό το σημείο όταν το εκτελεί μου βγάζει το μήνυμα (cant enter break mode at this time) μήπως ξέρει κανεις πώς μπορώ να σταματήσω την εμφάνησει του μηνύματος.
End If
SearchOrReplace = True
Else
SearchOrReplace = False
End If
Ευχαριστώ
Set mdl = Nothing
|