O
O
Oleg2020-10-01 17:16:27
Macros
Oleg, 2020-10-01 17:16:27

How to make a VBA script for processing a letter?

Good afternoon! I am just starting to understand VBA, and this is the task that was set. Something needs to be done so that the employee creates a letter, this letter is automatically assigned an outgoing number and this number, as well as the subject of the letter, the addressee, date and performer are recorded in the database. The solution I see is the creation of a Word document template with a VBA macro that first makes a query to the database, takes the last number from there, increases it by one and inserts it in the right place in the document. Then it writes the assigned number back to the database, simultaneously collecting information from the fields "Subject", "addressee", "performer".

Actually, the following questions arose:
1) how to make a template correctly so that later from the script to look for filled fields?
2) what is the best way to make macro management so that it is convenient? is it possible to somehow make some button in Word so that the macro is pressed and launched (inserted the number of the letter and took the subject, etc.). I know about hot keys, but this may not be convenient for everyone.
3) how to make sure that the template is always original when opened? I mean that after filling out and creating a letter, a person saves the finished letter and the template returns to its original state.
4) whether it is possible to save the letter as PDF by means of VBA?

Perhaps there are more correct or perhaps simpler solutions to solve my problem, if you tell me about them, I will be grateful.
Thanks in advance for your attention :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Korotenko, 2020-10-01
@firedragon

I see you came from the wrong side.
Create a distribution group let 's say
[email protected]
Any user sends mail to this mailbox
Your server runs either a macro or a handler.
There is an add-on for exchange, just move the mouse and create a workflow.
For unix servers use procmail and a simple php script
for mail the id is calculated by the server itself. Details here
mossdevel.blogspot.com/2013/05/automaticaly-detect...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question