p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access VBA (http://p2p.wrox.com/forumdisplay.php?f=80)
-   -   How to keep a path unbroken in VBA? (http://p2p.wrox.com/showthread.php?t=85704)

SunnySide November 16th, 2011 03:29 PM

How to keep a path unbroken in VBA?
I have the Code:
Dim stAppName As String

stAppName = ("C:\Program Files\Microsoft Office\Office12\EXCEL") & " " & "\\Directory\Finance\filename\Database" & " " & "Tools\Drop" & " " & "Ship\Dropship_Payments_Import.xls'"
Call Shell(stAppName, 1)

Cmd on a button in an Access Form. It brings you to the excel program just fine, but it can't find the file, due to the path being broken at the spaces. The company is large and the folder names can not be changed. What's the best way to ignore spaces in a path. The error says it can't find the file, which is split by the spaces in folder names.


disel2010 November 17th, 2011 10:15 AM


it just be sufficient to put the path to the excel program and path to the excel file between quotation marks.

Like this:

stAppName = """C:\Program Files\Microsoft Office\Office12\EXCEL""" & " " & """\\Directory\Finance\filename\Database" & " " & "Tools\Drop" & " " & "Ship\Dropship_Payments_Import.xls"""

SunnySide November 17th, 2011 11:20 AM

That works!!!! Thanks so much!

All times are GMT -4. The time now is 02:02 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.