Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2007

Tip: Looking for answers? Try searching our database.

Quote marks around file names

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bear - 25 Sep 2007 19:58 GMT
When I use Dialogs(wdDialogFileOpen).Name, a name with space characters in it
is returned in quotes. A single-string name is returned without quotes.

Does anyone have any optimized code they'd like to share to handle this
situation? All I can think of is to test the first character and od
Mid(.Name, 2, Len(.Name) - 2).

Is that about as good a way as any?

Bear

Signature

Windows XP, Word 2000

Karl E. Peterson - 25 Sep 2007 20:07 GMT
> When I use Dialogs(wdDialogFileOpen).Name, a name with space characters in it
> is returned in quotes. A single-string name is returned without quotes.
[quoted text clipped - 4 lines]
>
> Is that about as good a way as any?

Hmmmm, not sure what you're trying to accomplish?  My best guess is that you want to
remove all quote characters?  If so,

 TheFileName = Replace(.Name, """", "")

oughta do.
Signature

.NET: It's About Trust!
http://vfred.mvps.org

Bear - 25 Sep 2007 20:16 GMT
Karl:

That's exactly what I'm trying to do, and you've suggested a neat way to do
it.
Thanks.

Bear
Signature

Windows XP, Word 2000

Jay Freedman - 25 Sep 2007 20:55 GMT
> When I use Dialogs(wdDialogFileOpen).Name, a name with space
> characters in it is returned in quotes. A single-string name is
[quoted text clipped - 7 lines]
>
> Bear

The statement

   strFN = Replace(strFN, """", "")

will return the result without quotes regardless of whether it had them.

The only caveat is that the Replace function didn't exist in Word 97 VBA. If
that's a problem, there are substitutes available on the Web, such as
http://www.vbforums.com/archive/index.php/t-243433.html.

Signature

Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

Bear - 25 Sep 2007 21:48 GMT
Jay:

Thanks! For my purposes Word 2000 is the earliest I have to worry about, so
this is a dandy solution.

Bear
Signature

Windows XP, Word 2000

> > When I use Dialogs(wdDialogFileOpen).Name, a name with space
> > characters in it is returned in quotes. A single-string name is
[quoted text clipped - 17 lines]
> that's a problem, there are substitutes available on the Web, such as
> http://www.vbforums.com/archive/index.php/t-243433.html.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.