![]() |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#2
|
||||
|
||||
|
Perhaps the following, though together with your other macro it should give you enough information to modify it to your needs.
Code:
Option Explicit
Sub Macro1()
Const strpath As String = "C:\Path\"
Const BAAR As String = "BAAR"
Const MARCA As String = "marca"
Dim strName As String
Dim strMessage As String
Dim fso As Object
Dim oDoc As Document
strMessage = "Raport de verif pt. dosar " & BAAR & vbCr & _
"In atentia d-lui " & strName & "," & vbCr & _
"Urmare a verificarii dosarului " & BAAR & " auto pagubit marca " & MARCA & _
"va transmitem atasat raportul de verificare." & vbCr & _
"Rog confirmati primirea." & vbCr & _
"Cu stima," & vbCr & vbCr & _
"Mihai STAICU"
Set fso = CreateObject("Scripting.FileSystemObject")
Select Case True
Case fso.FileExists(strpath & "Mail AU.docx")
Set oDoc = Documents.Add(Template:=strpath & "Mail AU.docx")
strName = "Adrian Uta"
oDoc.Range.Text = strMessage
oDoc.SaveAs2 FileName:=strpath & "AU.docx", addtorecentfiles:=False
Case fso.FileExists(strpath & "Mail EN.docx")
Set oDoc = Documents.Add(Template:=strpath & "Mail EN.docx")
strName = "Emilia Negoita"
oDoc.Range.Text = strMessage
oDoc.SaveAs2 FileName:=strpath & "EN.docx", addtorecentfiles:=False
End Select
lbl_Exit:
Set fso = Nothing
Set oDoc = Nothing
Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Macro to highlight repeated words in word file and extract into excel file | aabri | Word VBA | 1 | 06-14-2015 07:20 AM |
Word 2007 , when I save a .doc or .docx file the file type is showing "Empty"
|
Tomc29 | Word | 9 | 06-10-2015 03:04 AM |
| How to create a MS word file that automatically logs something specific inside other WORD files? | meys | Word VBA | 1 | 01-04-2015 05:22 AM |
Macro to create new word doc and save the file using String found in the document
|
VBNation | Word VBA | 2 | 02-08-2013 07:14 AM |
Word Macro That Checks a Check Box Form Field When File Print is Executed
|
DKerne | Word VBA | 4 | 06-09-2011 11:54 AM |