title: calling Batch file in VBA not working properly
body: <p>I'm trying to create a program that can be used by other people. Currently, my files are in the directory <code>C:\Documents and Settings\jpmccros\Desktop\test</code></p>
  
  <p>This directory contains my <code>macro.xlsm</code>, <code>names.bat</code>, and another sub-directory called <code>Data</code>.</p>
  
  <p>The batch file <code>names.bat</code> does the following:</p>
  
  <pre><code>cd data
  
  dir/b/o:n &gt; names.txt
  </code></pre>
  
  <p>This does exactly what I want it to do. When I open the batch file (which is in the directory <code>C:\Documents and Settings\jpmccros\Desktop\test\</code>, the MS DOS Command Prompts starts in <code>C:\Documents and Settings\jpmccros\Desktop\test\</code> then runs my commands and makes my file <code>names.txt</code>, and puts it exactly where I want it.</p>
  
  <p>When I open up <code>macro.xlsm</code> and run the macro1, it calls the batch file to open.</p>
  
  <p>This is my macro command:</p>
  
  <pre><code>Dim names_txt, names_bat, full_name, filename, folder As String
  Dim position As Integer
  Dim pathcrnt As String
  full_name = ThisWorkbook.FullName
  filename = ThisWorkbook.Name
  position = InStr(1, full_name, filename, 1)
  position = position - 1
  folder = Left(full_name, position)
  
  names_bat = folder &amp; "names.bat"
  
  Shell names_bat, vbMaximizedFocus
  </code></pre>
  
  <p>Now here is my problem: The macro actually opens the batch file, or at least it opens the MS DOS Command Prompt. However, when it opens the batch file, the initial directory is:</p>
  
  <p><code>C:\Documents and settings\jpmccros\My Documents</code></p>
  
  <p>I need this batch file and macro to be dynamic, therefore I need the batch file to open up its displaying directory. What's going on with this?  Is there a command I can write on my batch file?  Is it something in VBA?</p>