Processes in Microsoft 365 for setting up Office apps, redeeming product keys, and activating licenses.
Give this a try:
.FindText = " " + "^063"
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am busy creating a macro, what I want is that the macro delete a space before a question mark, without changing the lay-out.
The problem is that a question mark in Publisher automatically is being converted to a wildcard. How can I prevent this in Publisher?
(I tried to use MatchWildecard like in Word but this doesn't work in Publisher)
my code:
Function RepText(SFind As String, sRep As String)
With Selection.ShapeRange.TextFrame.TextRange.Find
.FindText = " ?"
.MatchCase = False
.ReplaceWithText = "? "
.Forward = True
.MatchWholeWord = False
.ReplaceScope = pbReplaceScopeAll
.Execute
End With
End Function
Processes in Microsoft 365 for setting up Office apps, redeeming product keys, and activating licenses.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
Give this a try:
.FindText = " " + "^063"
if i use your code, some random letters are changed by the macro into question marks and thats exactly the problem what we are trying to solve.... any ideas how we can avoid this?
Your previous macro required that you select each text box to search. This searches the entire document and replaces all instances:
Sub ReplaceText()
With ThisDocument.Find
.FindText = " " + Chr(63)
.MatchCase = False
.ReplaceWithText = Chr(63) + " "
.Forward = True
.MatchWholeWord = True
.ReplaceScope = pbReplaceScopeAll
.Execute
End With
End Sub
We have tried this methode before but the replace function keeps seeing the question mark as a wildcard as the sRep ans sFind are remainders of a previous trial
Try substituting Chr(63) for the question mark:
.FindText = " " + Chr(63)
.ReplaceWithText = Chr(63) + " "
But you have other issues here. You've written it as a function but are using it like a sub. Neither of the parameters passed to the function (SFind and sRep) are used in the code.