Results 1 to 2 of 2

Thread: Error exporting crystal file

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2001
    Posts
    37

    Error exporting crystal file

    I have a routine to export Crystal Reports files to pdf. If I try to set the pdf file name automatically, I receive an error saying that the file is in use by another program. If I hard code the file name, the code works ok. That's the relevant code I am using:

    spdffilename = "C:\Docs\MyFile.pdf"

    sDestinationOptions.DiskFileName = spdffilename
    oexportoptions = pReport.ExportOptions

    With oexportoptions
    .DestinationOptions = sDestinationOptions
    .ExportDestinationType = ExportDestinationType.DiskFile
    .ExportFormatType = ExportFormatType.PortableDocFormat
    End With

    pReport.Export() 'Error occurs here

    If I change the first line to:
    spdffilename = System.IO.Path.GetFileNameWithoutExtension(pReport.FilePath) & ".pdf"

    The code stops working when the export method runs. Can anyone see what is wrong in this line?

    Thanks,

    Robert

  2. #2
    Lively Member
    Join Date
    Aug 2002
    Location
    outerspace
    Posts
    126
    im thinking it may be a permissins problem with where you are trying to save the file possibly. Just a thought. OR your not creating a unique name for you pdf and it cant rewrite over the exisiting file just another thought
    "All those who wonder are not lost" -j.r.r tolkien

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width