Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 16th, 2011, 03:29 PM
Authorized User
Points: 102, Level: 2
Points: 102, Level: 2 Points: 102, Level: 2 Points: 102, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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.

suggestions?
Reply With Quote
  #2 (permalink)  
Old November 17th, 2011, 10:15 AM
Authorized User
Points: 448, Level: 7
Points: 448, Level: 7 Points: 448, Level: 7 Points: 448, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2011
Posts: 86
Thanks: 1
Thanked 12 Times in 12 Posts
Default

Hi,

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

Like this:
Code:
stAppName = """C:\Program Files\Microsoft Office\Office12\EXCEL""" & " " & """\\Directory\Finance\filename\Database" & " " & "Tools\Drop" & " " & "Ship\Dropship_Payments_Import.xls"""
Reply With Quote
The Following User Says Thank You to disel2010 For This Useful Post:
SunnySide (November 17th, 2011)
  #3 (permalink)  
Old November 17th, 2011, 11:20 AM
Authorized User
Points: 102, Level: 2
Points: 102, Level: 2 Points: 102, Level: 2 Points: 102, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2011
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
Default

That works!!!! Thanks so much!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



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


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