Home > Software engineering >  Consult predecessors: related problems about CAD VBA text modification and deletion
Consult predecessors: related problems about CAD VBA text modification and deletion

Time:09-17

I'd like to replace the graphic in the single-line text, but has a problem, so up to consult everybody:
1, I will need to be replaced in the graphical text set to A unique name, called "A text", for example, A single line text in the graphic and only one is called "A text", I use the strFind="A text," strReplace="text" B, can replace, but if I dialed the wrong number, want to change the text to "C" text, question, reoccupy strFind to find, but in the graph is called "text" B has A lot of, it is not the only, will go wrong, after replace with strReplace
2, have a kind of method, handle to lock the text, by handle modify text, because I check the related information, it handles are the only, if so, no matter what the text is, all can pass the handle to lock it, to modify, so as not to mess up, don't know whether I the idea right?
3, if the above methods are not, whether can by removing text, and then insert the xinwen was implemented? If it can, when I was in the program runs, the first action is to remove the text, and then insert the new text in a fixed position, so will not disorderly,

Above is just my idea, VBA beginner, many do not understand, can only step by step, a piece of text operation, will only use strFind and strReplace to replace, can't other method, do not know how to write code, there is no way, only up to bother everybody, hope to have know elder glad, put a piece of code guidance, thank you!

CodePudding user response:

1. Very few people here used CAD, suggest you take a closer look at strReplace that ever replace limit, to replace the limited number of parameters,
Arguably, textual substitution operation, no matter how many times to replace, and should not be "wrong" is ah,
You said "make mistakes", then what is the error message, how is not clear!!!!!!!!!!
(words, you are the strReplace CAD VBE varies with the procedure or function?)

2. The "text" should be no handle!!!!
Taking ten thousand steps back, even if has a handle, what makes you to make sure that you "want to replace that part of the text" of the handle!
If can determine a certain period of "text", must have related methods to change this paragraph of text content, pass "handle" what matter...

What 3. Remember there is a kind of CAD format of the document, is in the form of "plain text", don't know what you can to deal with the document into the document format to deal with?
You can try to see the document after transformation format, are there what you need to deal with all the information in it,
If it can be converted to deal with, and see if I can get you;
If not done, it is recommended that you provide document sample, look have the solution,

CodePudding user response:

Remember the first A text starting position does not have to,

CodePudding user response:

reference 1st floor Chen8013 response:
1. Very few people here used CAD, suggest you take a closer look at strReplace that ever replace limit, to replace the limited number of parameters,
Arguably, textual substitution operation, no matter how many times to replace, and should not be "wrong" is ah,
You said "make mistakes", then what is the error message, how is not clear!!!!!!!!!!
(words, you are the strReplace CAD VBE varies with the procedure or function?)

2. The "text" should be no handle!!!!
Taking ten thousand steps back, even if has a handle, what makes you to make sure that you "want to replace that part of the text" of the handle!
If can determine a certain period of "text", must have related methods to change this paragraph of text content, pass "handle" what matter...

What 3. Remember there is a kind of CAD format of the document, is in the form of "plain text", don't know what you can to deal with the document into the document format to deal with?
You can try to see the document after transformation format, are there what you need to deal with all the information in it,
If it can be converted to deal with, and see if I can get you;
If not done, it is recommended that you provide the document sample, look have the solution,

Thank you for your reply! Has done, obtains the text handle, can get the contents of a text object, cad of handle to handle different from other languages, it is the character is not the integer, once again thank you for your reply!

CodePudding user response:

Wait for a great god!!!!!
  •  Tags:  
  • VBA
  • Related