How to automate routine Microsoft Word operations? - text

For example, I got text document. Like so:
At around 6am last Bank Holiday **Monday** I was called by our **Australian** news desk who informed me of the news. Stumbling from my bed to the lounge, still half asleep and with the remnants of an enjoyable **Sunday evening** taking revenge on my skull, I was struggling to process the notion of putting one foot in front of the other let alone news that the world's most **notorious terrorist** had been killed.
It is just for example.
Our work is to replace bold words with our own that we take from the paper docs. The operation is very routine, you scroll text, find the word, delete it, type in your new word etc.
I thought maybe there is a way to automate it? Maybe with macros or some other mechanism?
Microsoft word version is 2000. For example I see it like window where it asks: Enter this: - ok - next window - enter this - and in the end it enters all data into new file.

Yes, there is a way. It is called Mail Merge.

yes, you can totally use Word Macros to automate using find and replace.. 1) Record a macro. 2) do find and replace 3) stop recording macro 4) look at vb, at a couple of loops if you need, etc. 5) assign macro to function key (it's easy in Excel at least, never had to do with Word)

Related

Python Assistant - Responses to variety of sentences.

I was wondering if anyone would be able to help me with a small problem. I am looking to start a project to speedup my normal time consuming processes on my computer. Within the code of my 'assistant' I would have all the functions hard coded but I wanted the flexibility of not having to type an exact sentence e.g. 'open sublime text' instead I would like to be able to talk freely and be able to say something along the lines of 'Please open sublime' or 'Can you please open sublime text'. I know that I could do something along the lines of:
if 'sublime' in text_input:
sublime()
The only problem is I have to hard code each one and if any other application have a similar word in the sentence it will perform the first if statement that is met with (if I say google sublime and the if statement for sublime text application is above the google if statement then it will open the application instead of googling it). Is there no simpler way to do this? Something more advanced or easier? Appreciate any help, new to stackoverflow and I am grateful if you could take your time to assist me with my problem.

Sublime text multiple cursors?

Sublime Text is so damn advanced and this seems like such a stupid question, but...
I started writing a for loop in PHP (using SFTP), loved that it gave me a choice to auto-generate the loop. However, it enters this weird multi-cursor mode, which
1)I am not really sure how to use/exit without using the mouse;
2) it seems useless, seeing as all 3 type the same thing, even though I need to change, for example, the $i > x or $i = x.
Although Sublime does indeed support the idea of multiple cursors (which is an incredible time saver and useful as all get out, as we're about to see), what you're actually asking about here is a snippet which in this case happens to also include multiple cursors.
The general idea is that for code that you're likely to type many times (e.g. a for loop), you can create a snippet that will generate the bulk of the text for you in one shot, and then allow you to easily customize it as needed. In this case, the snippet in question is part of the default functionality of Sublime and is provided by the shipped PHP package.
To answer point #2 in your question first, this is far from useless. As seen here, I enter the text for and then press Tab to expand the snippet out. The first thing to notice here is that the status line says Field 1 of 4 to tell me that I'm in a snippet and that it contains four fields.
The first field is the name of the control variable for the loop, and all of them are selected so that as I change the name, all of them change at the same time because when there are multiple cursors, the text you type appears at all of them at the same time.
Once I'm done changing the name of the variable, I press Tab again to go to the next field, which allows me to easily change the point at which the loop starts. Another press of Tab takes me to the third field, where I can specify where the loop ends.
One last press of Tab exits the snippet and selects the text in the loop, so I can start writing my code (caveat: I am not a PHP developer).
At this point you can see Sublime offering another snippet for echo, which would expand out to an echo statement complete with quotes, then allow me to edit the text in the echo and skip to the end.
Circling back around to the first point in your question, you can use Esc at any point to jump out of a snippet and go back to regular editing. You can also use Tab or Shift+Tab to move through the fields in the snippet, and pressing Tab at the last field in the snippet exits it as well.
In this particular case, the first field in the snippet sets up multiple cursors, and so exiting the snippet while this field is active leaves multiple cursors in effect. You can jump back to a single cursor by pressing Esc one more time (this is true regardless of how you ended up with multiple cursors).

Finding 2 numerical strings on same line

I am new to Notepad++ and have ben researching how to do this, but it seems each answer I try to mimic doesn't work correctly.
Here is the scenario:
I have 2 text files, each with ATM transactions such as time of transaction (In military time, such as 18:09) and transaction amount (Displayed as 43.00)
I need to find a way to search the document so that it only returns matches where both the time and amount are there, and on the same line of the document.
Example would be, I need to find on this huge text file where both 43.00 and 18:09 appear on the same line, allowing my to verify the transaction was valid.
Any ideas on how to do this? I am using the latest Notepad++6.8 and have downloaded the compare plugin.
Thank you and I will begin researching how the coding works in notepad++ in the meantime, as I am not an experienced programmer (Just had 1 college course in C++ which I loved but eh)
Cheers!
Ctrl-F, Select "Regular expression" as Search mode and then write:
8:09.*43.00
Ctrl F, search for 43.00 or 18:09.

Excel open same names files

I need to create a button in Excel that opens a dialog box and I select the file that I recorded on the second sheet, but I also automatically select other files with the same name differs just ending. So I need to choose one file, and always record 2-3 more with the same name and to open a new worksheet. How to do it?
What you need to select the file abc.txt and uploaded to other files abc.ydd and abc.dyk name will always be the same only the ending will be different.
An advice for any work you are doing: Break down your big task into small steps as often as needed until the steps are small enough so that you know how to process them.
On your specific programming task, this means, you should break it down into:
You need a button on one of the excel sheets.
That button has to open a dialog box for selecting a file
I don't know whether it can be any arbitrary file or a specific one, as you wrote that the file was recorded on another sheet. I think that makes no difference at all.
After finishing the file selection, you have to evaluate the result of the dialog box (OK -> which file, ABORT -> do nothing).
Take the file name, remove the extension and search for other files (in the same directory or elsewhere) with that name.
I don't know why you want to open another worksheet. Of course you can do that, but if you want to show the content of that files in the worksheet, they better be excel files.
How you do these suggested steps is something you need to find out by yourself. Or you are lucky and find someone else who has plenty of free time to do that for you, but I don't think you will be that lucky, especially after providing a quite vague description of your problem.
In general, stackoverflow is for asking for solutions to specific programming problems, not for providing ready-to-use solutions for beginners. Take a look at VBA manuals and tutorials. They can be found widely across the internet and in book stores.

Extracting a page from a pdf using a keyword

OK so im quite sure i cant do this with excel vb or for free even.
Im writing these macros for work, and one of them needs to be able to chose a pdf based on keywords.
Then go into the pdf, search either the titles of the pages or the text on the pages themselves using a different set of keywords.
When it finds the page that matches one of the keywords in the second set, it will extract the whole page, as is, to a single page pdf.
This can then be attached to email.
This will be only a small part of the purpose of the macro.
From what i understand, im probably going to have to find an SDK, pay for it, and write a separate program in C# or VisualBasic which is run when the macro needs.
I dont even need the code, maybe just a point in the right direction :D
In the end i got a program called pdftk.exe, free, and runs in command line.
With this i can export the Bookmarks listing to txtfile.
Search text file for string/keywords.
Jump down a line or two and grab associated page number.
Then use the same exe to extract that page and save as specific name, then my vba macro can grab that newly created 1 page pdf.
Ive seen code on this site for creating delays while another process is doing its thing, so i will try to implement that also.

Resources