I would like to be able to press a button on a form and select a PDF file and copy it to a directory that will be the default for the application that I am creating.
this means that all the pdf files are in the same place regardless of who made them and where they originally reside.
this works when there is no file to overwrite but as soon as the file exists in the new place I cant overwrite as its already open.
I understand why I get the error
This is the error I get.
Is there any way to close the file so I can overwrite it with out leaving the form?
this means that all the pdf files are in the same place regardless of who made them and where they originally reside.
this works when there is no file to overwrite but as soon as the file exists in the new place I cant overwrite as its already open.
Code:
dim defdir as C = "C:\Users\Public\3.CadCamPC CAD files" dim this_path as C dim bare_path as C dim app_path as C dim shadowed as L this_path=:a5.Get_Path() bare_path=:a5.Get_Master_Path() if len(alltrim(bare_path) ) = 0 then 'if zero, not shadowed shadowed =.F. app_path = this_path + chr(92) else shadowed =.T. app_path = bare_path + chr(92) end if filenameSource = ui_get_file("Select File", "", defdir +"\*.pdf") FileNameDest = topparent.PRODUCT_ID.value PathNameDest = app_path + "PDF_Files\Autopdf\\" file.copy(filenameSource,PathNameDest + filenameDest+ ".pdf") :product:pdfviewer1.refresh()
This is the error I get.
---------------------------
Error
---------------------------
Script:OnPush line:27
file.copy(filenameSource,PathNameDest + filenameDest+ ".pdf")
The process cannot access the file because it is being used by another process.
C:\Users\Cadcam\Documents\Production\AutoProd\PDF_Files\Autopdf\1.pdf
---------------------------
OK
---------------------------
Error
---------------------------
Script:OnPush line:27
file.copy(filenameSource,PathNameDest + filenameDest+ ".pdf")
The process cannot access the file because it is being used by another process.
C:\Users\Cadcam\Documents\Production\AutoProd\PDF_Files\Autopdf\1.pdf
---------------------------
OK
---------------------------
Comment