View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
Brassman[_10_] Brassman[_10_] is offline
external usenet poster
 
Posts: 1
Default VBA to open a .mdb file


The problem is the spaces in the cPath variable. Try this:


Code
-------------------

Sub OpenLog()
cPath = "I:\Plant\SHIFTLOG\Shiftl~1.mdb"
Shell "msaccess.exe" & " " & cPath, vbMaximizedFocus
End Sub

-------------------


In order to avoid the spaces in the file path, use the old 8dot
format. If there is more than one file in "I:\Plant\SHIFTLOG\" tha
starts with "Shiftl" then you may need to change "Shiftl~1" t
"Shiftl~2" or perhaps a higher number (depending on where it fall
alphabetically ordered in that file).

Also, i think KeepITCool had an extra """ in his statement. I teste
my code with a mdb file on my computer and it worked.

Hope it works for you too

--
Brassma
-----------------------------------------------------------------------
Brassman's Profile: http://www.excelforum.com/member.php...fo&userid=1329
View this thread: http://www.excelforum.com/showthread.php?threadid=49585