Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 16th, 2011, 03:29 PM
Authorized User
Join Date: Nov 2011
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
Default 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.

Old November 17th, 2011, 10:15 AM
Authorized User
Join Date: Jan 2011
Posts: 86
Thanks: 1
Thanked 12 Times in 12 Posts


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"""
The Following User Says Thank You to disel2010 For This Useful Post:
SunnySide (November 17th, 2011)
Old November 17th, 2011, 11:20 AM
Authorized User
Join Date: Nov 2011
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts

That works!!!! Thanks so much!

Similar Threads
Thread Thread Starter Forum Replies Last Post
absolute path vs relative path for substitution group elements ptn77 XSLT 3 June 16th, 2011 10:04 AM
Need Help with path for loading Pics (app.path) Tabbasum Beginning VB 6 2 November 15th, 2007 04:57 AM
Implementing the all-path shortest path problem bitwords XSLT 1 December 6th, 2006 11:37 AM
Convert logical path to absolute path zoostar J2EE 1 April 15th, 2005 10:36 AM
Path for a template in VBA Piblon Excel VBA 6 November 27th, 2003 01:27 AM

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