I am in the middle of automating a process here at work, the program takes a word, "pencil" for example, from excel. It will then open up a word document with content already in it (premade template). The program will then find all instances of a string, "placepencilhere" for example, and will replace that instance with the string from excel.
Basically I want to be able to take a variable that has a stored string value from excel and use it to replace another variable in a word document.
I tried recording a replace (ctrl+f, replace tab) macro, copying the code, and inserting it into the excel vba code.. but I get a error message. Here is what I have:
I have never used VBA in word before, so I am assuming I am making it more complicated than it needs to be. I have a macro that stores 20 excel values as variables, then opens up a word document. I want to replace values in word with my values in excel. I keep getting an error with the replace part. I do not want to use bookmarks or mail merge. MSWord is a reference in excel VBA.
Code that stores excel variables (Example: Var1=Data1 and Var2=Data2)... 'Opening up the correct word document Dim WdApp As Object, WdDoc As Object Set WdApp = CreateObject("Word.Application") WdApp.documents.Open ThisWorkbook.Path & "" & Range("D1").Value & ".doc" WdApp.Visible = True
I'm looking to simply delete certain words that are in cells, without having to delete rows, columns or the entire cell. I can use 'find and replace' and replace the particular word with a space, but I really want to delete the word. I'm using both Excel 2003 and 2000.
I have codes (of three, four, or five digits) in Column A,names in column B, and names in column G.
The names in Column B and Column G are the same ones, but not in the same order, and they do not repeat exactly the same (e.g. I can have "Peter" in A10 and "Peter Jr." in A62, but not "Peter" and "Peter" again.
Each code belongs only to one name and never appears twice.
In K I want a formula that does the following:
K1: if the name in G1 is found anywhere in Column A, then bring the code that belongs to that name in G1.
(E.g.: If I have "Peter" in G1, and then "Peter" is found in B16 with the code "100" in A16, I want the code "100" of the A16, to come to K1).
I'm from Bavaria, Germany. Right now, I am doing an internship for my studies. my problem: I need a search procedure which shows an Input Box where you can enter a word to search for. It should work like the original Excel search (Ctrl-F), but with a simpler design, like with my own Text "Enter your Query" and a Button "Submit Query" / "Quit search". Is there the possibility to Highlight the Search Target? The problem hereby is that this highlighting should not be permanent. That means the user sees the target for which he searched for, the cell highlighted in a different color, etc. But as soon as the user clicks onto another cell, etc., the highlighting vanishes. If there is no fitting match, there should be a MessageBox like "Sorry the Target xyz cannot be found"
I use the following code. I want to make Replace only in the case which there is a whole word in a part of a cell, but not in part of specific characters.
Example: In the code i want to replace the word "to" but replaces all the words that contains "to". For example in the word together lets only the characters gether, and in the word tonight lets only the characters night etc.
I found the below code and have tried adapting it without success.
Code: Sub Colorize_Word() Dim Found As Range, FirstFound As String Dim FindWhat As String, MyColor As Long, Counter As Integer
MyColor = 3
FindWhat = LCase(InputBox("Find what word?", "Color word"))
This code finds any string in a cell of your choice and colors it red. I would really like to replace the string with my own string of text. I couldn't use the simple find and replace function as this replaces the WHOLE cell content not just one word.
I believe the line of code that needs editing most is this one
Looking to build a simple find and replace with an added condition that it must match the whole word since some of my data appears as below:
I am trying to replace abc with alphabets and I need the result: alphabets.abc_no not alphabets.alphabets_no.
What do you think the best approach to this would be? All my data that I need converted is in one column (Column C) which are thousands of rows long and on another sheet I have a list of the conversions I need to do (about 150 - columns A and B) setup like:
I am looking to automate a process where information is sent to someone in a text format and they in turn transfer that data to an excel file. It basically looks like this (but includes a lot more info):
Service Request #: 123456 Instrument Type: New Instrument Lot/Serial #: 123456 SR Type: Product Complaint Service Coverage: Maintenance Agreement
The info on the left (text preceding the colon) is always the same but the values following the colon can change. The excel file has all of the text before the colon and they just enter the information into the cells. I am looking to make it so that an Excel macro (or maybe a word/outlook macro) automatically scans the text document and sends this info to the exact same cells in excel every time.
The text file is actually a message from an Oracle database and I am not going to be able to make any changes to the way the data comes in.
I create a monthly excel sheet regarding customer & their payment like this.. Suppose..
Month January 2007 Customer A 2000 Customer B 2000 Cust C 3000
Cust D 3000 Cust E 4000 Cust A 2000
Cust B 2000 Cust A 2000 Cust G 4000
Now, I want to do somthing like that If a customers Name repeat in another month, I mean Cust. A name has been already entered in Month January & if it comes again in february then it should be automatically replaced or highlight with red line Or something like that.
I am looking for a syntax or function wherin i can replace all lines in different cells containing specific string or text in it. e.g. Few cells in sheet contains " This guy is for deployment", other few cells may contain "guy is for core deployment" and other cells may have " project is specific deployment". I want to replace all such lines which contain a word "deployment" with ony one word "Deployment".
Is it possible to export Excel cell contents to Word fields in a protected Word document? For example...
What code would be needed to tell Excel to open up, copy and export the contents of A2 in the active sheet of a workbook to "Field 2" in a Word document named "Report 01" and then put the contents of B2 to "Field 2" etc?
Do both applications have to be opened up at the same time or is Excel able to open up Word on its own? Will the macro be able to....
1. Automatically open up the correct Word document?
2. Look ONLY in a certain folder for the "Report 01" Word document?
Bring up a "selection" box that allows you to select the document you wish Excel to export it's data to?
3. Close and save the Word Document without any user intervention?
how to accomplish more work quickly is proving difficult. I am making a word cloud of survey responses for my boss and he doesn't like to see similar words in the cloud (like Ease and Easy or even Fast and Quick). I have several hundred of these responses that are open ended answers that say one or many of these terms. Any way I can separate all the words and have them in one neat column? If I can get to that point, replacing those words will be simple enough.
I have a set of data which contains " Account Heads" in Column "A" and "Data" in Column "B", "Data" contains "Account Heads" with some other text as well, i want to have the Account Head in Column "C" based on the "Account Heads" from "Data"