Solved

Opening PDF File in VB6

Posted on 2013-05-23
3
642 Views
Last Modified: 2013-05-23
I have small application where i have store .pdf file name in database.
when i click any .pdf file name which are stored in directory name with out spaces it is working fine.
when .pdf file is in sub-directory with spaces and file name with spaces it is not working.

following is code in vb6
    Open "D:\ReadPDF.Bat" For Output As #1
        Print #1, "D:\Test.pdf"
    Close #1
    Shell "D:\ReadPDF.Bat", vbHide

above code working fine.


    Open "D:\ReadPDF.Bat" For Output As #1
        Print #1, "D:\test data\test try\Test test.pdf"
    Close #1
    Shell "D:\ReadPDF.Bat", vbHide


when any file name contains spaces it is not working

Thanks in advance
0
Comment
Question by:nitin_s_shah
3 Comments
 
LVL 11

Accepted Solution

by:
Guru Ji earned 250 total points
ID: 39191341
Try wrapping the filename with the spaces in quotes like below

Print #l, """D:\test data\test try" & "\Test test.pdf"""

Open in new window


OR

Print #l, """" & "D:\test data\test try" & "\Test test.pdf" & """"

Open in new window

0
 
LVL 5

Assisted Solution

by:advfinance
advfinance earned 250 total points
ID: 39191444
You need to add double quotes at the start and end
e.g.
shell """c:\test path\test file.pdf"""
0
 

Author Closing Comment

by:nitin_s_shah
ID: 39191588
Thanks both the experts for kind and prompt help

Once again Thanks

Nitin Shah
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
When you upgrade from Windows 8 to 8.1 or to Windows 10 or if you are like me you are on the Insider Program you may find yourself with many 450MB recovery partitions.  With a traditional disk that may not be a problem but with relatively smaller SS…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now