Need help in creating macro
-
I want to store the found text in the array. but it seem's that i put a wrong code because it only find's letter "i"
-
It has been SOO long since I worked with VBA (or whateve they call it now) that I cannot even follow this easily.
-
@junrustia said:
I want to store the found text in the array. but it seem's that i put a wrong code because it only find's letter "i"
That's why I asked :D. Check again your code.
-
@JaredBusch Here in the Philippines, there are still lots of big company that uses VBA.
-
@Pol said:
@JaredBusch Here in the Philippines, there are still lots of big company that uses VBA.
VBA continues to be used because it is the language of MS Office apps. If you need to automate your office suite, it is the only choice.
-
@JaredBusch said:
It has been SOO long since I worked with VBA (or whateve they call it now) that I cannot even follow this easily.
@scottalanmiller said:
@Pol said:
@JaredBusch Here in the Philippines, there are still lots of big company that uses VBA.
VBA continues to be used because it is the language of MS Office apps. If you need to automate your office suite, it is the only choice.
Yes...my office is FULL of Excel sheets and many with VBA and I don't ever see us going away from it. While kind of a messy language, it is perfect for small businesses. And another reason I am getting my MOS Master and hitting the VBA books. They want me to be a programmer and a "know it all" in Office in addition to my System Admin duties.
-
@garak0410 only perfect for small business because it is all that there is for office automation on Ms Office. VBA is a horrible language for small businesses to be saddled with, though.
LibreOffice uses BASIC, JavaScript, Python or BeanShell. So you can choose.
-
@scottalanmiller said:
@garak0410 only perfect for small business because it is all that there is for office automation on Ms Office. VBA is a horrible language for small businesses to be saddled with, though.
LibreOffice uses BASIC, JavaScript, Python or BeanShell. So you can choose.
If, God willing, I am in this job for years to come, I plan on sharpening my skills in other languages in hopes we can get off of VBA...but for now, its a way of life.
-
@junrustia So I had a chance to look at this again today. Your overall premise is not simple. Where is document1.doc coming from? how is the data being placed in it put there?
You stated that you want to use word 1 in document 1 as the search for document 2. then to select an entire section of document 1 and paste it into document 2 where word 1 was found in document 2.
You need to have some intelligent organization to document 1 if you plan on being able to do this. Document 1 is your "control" document and its structure will have to be known in order to use it as a base to loop through.
Right now your code is not really doing any selecting based on objects (words). you are simply using the find then using the selection.move stuff that looks like it was part of a recorded macro.
Your entire subroutine here is also needing to be in some type of loop for it to execute more than once. I do not see any looping mechanism. That is why it only executes once.
Finally. you are telling document 2 to specifically search for i. You need to change .Text = "(i)" to .Text = MyAr(i) or maybe to .Text = "(" & MyAr(i) & ")"
-
Hi @JaredBusch you absolutely understand what i'm trying to do but I already done with this project.
but anyway thank you for your reply i really appreciate it. maybe a few weeks later i will ask again for your help. hahaha