Jim Lawrence
accessd at shaw.ca
Tue Jul 23 16:02:01 CDT 2013
It is just overkill, unless someone is running a large command based application and then the syntax would be something like cmd /k. Jim ----- Original Message ----- From: "Stuart McLachlan" <stuart at lexacorp.com.pg> To: "Access Developers discussion and problem solving" <accessd at databaseadvisors.com> Sent: Tuesday, July 23, 2013 12:25:36 PM Subject: Re: [AccessD] Using the SUBST command Do you havae a cmd.exe in the rooot of drive C:? That would be most unusual. On 23 Jul 2013 at 23:32, Bryan Fitzpatrick wrote: > Hi List > > Has anyone used the SUBST command from VBA? > > I am currently developing a system in Access 2010 which requires data to > be exported to a Word template. Easily done. > The problem comes in with the length of the paths involved with the > storage folder for the templates and the created documents. > > I would like to use the SUBST command to map the path to a drive, action > the import or export, and then disconnect the drive. > But I cannot get the command to run. > > Code snippet: > .... > .... > .... > Save: > Shell ("c:\cmd.exe /c SUBST X: " & gstrDraftIMPPath) > > myFileName = "ServiceNo " & mRsClients!ServiceID & "- > Client " & mRsClients!ClientName _ > & " Personal Officer " & > mRsClients!PersonalOfficerName > > .SaveAs "X:\" & myFileName, wdFormatDocument > End With 'my word doc > > > If I map the drive manually, it all works perfectly. But I can't get it > to map automatically. Has anyone done this before, or guide me to the > correct Shell syntax if it's wrong > > Thanks in Advance > -- > */Bryan > /* > > > > ----- > No virus found in this message. > Checked by AVG - www.avg.com > Version: 2013.0.3349 / Virus Database: 3204/6513 - Release Date: 07/23/13 > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com