Solved

Opening PDF File in VB6

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

Get Actionable Data from Your Monitoring Solution

Your communication platform is only as good as the relevance of the information you send. Ensure your alerts get to the right people every time with actionable responses. Create escalation rules that ensure everyone follows the process and nothing is left to chance.

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…
The password reset disk is often mentioned as the best solution to deal with the lost Windows password problem. In Windows 2008, 7, Vista and XP, a password reset disk can be easily created. But besides Windows 7/Vista/XP, Windows Server 2008 and ot…
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…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…

690 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