![]() |
|
|
|
#1
|
||||
|
||||
|
Hi macropod,
I took the code for Filethere from following site: Code:
http://word.tips.net/T000819_Determining_if_a_File_Exists.html This part gets doc name: Code:
'get my document name without .doc/.docx and other extensions
Dim doc As String
If InStrRev(ActiveDocument.Name, ".") <> 0 Then
doc = Left(ActiveDocument.Name, InStrRev(ActiveDocument.Name, ".") - 1)
Else
doc = ActiveDocument
End If
Code:
'check if my image exists and matches my document name 'if image found then add new page and copy image If FileThere(ActiveDocument.Path & "\images\" & doc & ".jpg") Then '>>>>> relates to the function written above Selection.InsertNewPage Selection.InlineShapes.AddPicture FileName:= _ ActiveDocument.Path & "\images\" & doc & ".jpg", _ LinkToFile:=False, SaveWithDocument:=True |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
batch file
|
romanticbiro | Office | 1 | 06-30-2014 06:04 PM |
| Batch adding Metadata to Docs | AndyTake2 | Word | 0 | 02-01-2013 10:18 AM |
Batch create Word documents
|
cdfj | Word VBA | 6 | 11-07-2012 01:03 PM |
Batch Edit Links
|
tosti | PowerPoint | 5 | 01-31-2012 12:51 PM |
Processing Time Intervals
|
pkrishna | Excel | 5 | 09-30-2011 06:24 AM |