Solved

Opening PDF File in VB6

Posted on 2013-05-23
3
639 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

762 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

16 Experts available now in Live!

Get 1:1 Help Now