accesshawaii
Oct 27 2006, 12:37 PM
I'm running into a problem here. I have a file in a directory similar to "C:\Files\My Directory\Excel.xls" I have no problem accessing the file if it's in the "C:\Files" directory but when it's in the "My Directory" one I get an error. I know it has something to do with "My Directory" being 2 separate words. I tried coding it "My_Directory" and still doesen't work. Anyone know what I'm doing wrong?
ChrisO
Oct 27 2006, 12:46 PM
It would help to know what code you are using but you could try: -
Chr$(34) & "C:\Files\My Directory\Excel.xls" & Chr$(34)
That should wrap the string in double quotes. (Remember apostrophes are valid within path and file names.)
If that doesn’t work can you post the code so we can look at it?
Regards,
Chris.
accesshawaii
Oct 27 2006, 01:05 PM
Thanks, Chris but it's not the excel part that I'm having a problem with. As I said, I can access the file fine until I place it in a directory that has 2 separate words such as "My Directory", That's the part that I'm coding wrong and need assistance with. Here's the line of code.
strAppName = "C:\Program Files\WinZip\WINZIP32.EXE -a -es C:\Files\My Directory\Test.zip C:\Files\My Directory\Test.xls"
As I said code works fine, it's just when I place the file in a directory with separated words in it. Thanks for your assistance. I have tried "_" and that does not work.
niesz
Oct 27 2006, 01:13 PM
I think what Chris meant was adding double quotes around each path....
strAppName = Chr$(34) & "C:\Program Files\WinZip\WINZIP32.EXE" & Chr$(34) & " -a -es " & Chr$(34) & "C:\Files\My Directory\Test.zip" & Chr$(34) & " " & Chr$(34) & "C:\Files\My Directory\Test.xls" & Chr$(34)
Edited by: niesz on Fri Oct 27 14:13:57 EDT 2006.
norie
Oct 27 2006, 01:14 PM
accesshawaii
Chris is actually on the right lines, you need to enclose the directory and path in quotes.
CODE
strappname = "C:\Program Files\WinZip\WINZIP32.EXE -a -es "
strappname = strappname & Chr(34) & "C:\Files\My Directory\Test.zip " & Chr(34)
strappname = strappname & Chr(34) & "C:\Files\My Directory\Test.xls" & Chr(34)
niesz
Oct 27 2006, 01:17 PM
Norie, I think you meant:
strappname = "C:\Program Files\WinZip\WINZIP32.EXE -a -es "
strappname = strappname & Chr(34) & "C:\Files\My Directory\Test.zip" & Chr(34) & " "
strappname = strappname & Chr(34) & "C:\Files\My Directory\Test.xls" & Chr(34)
accesshawaii
Oct 27 2006, 01:23 PM
That be the one. It works!!!. Thanks, guys. Amazing, how much extra work having spaces in file names cause. If the files didn't have the spacing, I could do all this on one line with no special characters or anything. Bad part is that theres around 7 sub directories that are all named like this. Should keep my busy. LOL
niesz
Oct 27 2006, 01:25 PM
Glad we could help.
norie
Oct 27 2006, 02:02 PM
Walter
What was I missing?

Looked fine to me, compiled, worked etc.
The only thing is that I didn't enclose the...Doh!
Just spotted the mistake as I was typing.
[censored] those pesky spaces.
niesz
Oct 27 2006, 06:27 PM
I hat eitw hens pace ss how upinal lth ewron gpl aces.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.