![]() |
|
|
Thread Tools | Display Modes |
#12
|
||||
|
||||
![]()
Without the documents this cannot be tested, but a few observations are warranted.
Why have you created another variable for strSubFolderNewName? Code:
strpat = strSubFolderNewName Your FileExists statements are never true because strSubFolderName doesn't end in a folder separator character, so the documents cannot be created. Thus the lines e.g. Code:
Case fso.FileExists(strpat & "Mail AU.docx") Set oDoc = Documents.Add(Template:=strpat & "Mail AU.docx") 'etc Code:
Case fso.FileExists(strSubFolderNewName & "\" & "Mail AU.docx") Set oDoc = Documents.Add(Template:=strSubFolderNewName & "\" & "Mail AU.docx") 'etc You have created CreateObject("Scripting.FileSystemObject") twice as fso and oFSO. You only need to create it once and use the same object twice.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
Thread Tools | |
Display Modes | |
|
![]() |
||||
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 |
![]() |
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 |
![]() |
VBNation | Word VBA | 2 | 02-08-2013 07:14 AM |
![]() |
DKerne | Word VBA | 4 | 06-09-2011 11:54 AM |