Solved

Opening PDF File in VB6

Posted on 2013-05-23
3
646 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

737 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