Hi
For archiving or printing it will be recommended to keep em separate,
and i sent you the code, because i'm not that good in vba and i don't know how to code it to
save a pdf for every user as user name in desktop or any place i choose.
Hi
For archiving or printing it will be recommended to keep em separate,
and i sent you the code, because i'm not that good in vba and i don't know how to code it to
save a pdf for every user as user name in desktop or any place i choose.
since the number of files is too big to extract it as 1 pdf with 2000 pages or printing 2000 pages on time
so the best solution will be output requests for every user separate as 1 pdf named as user name
so at the end i will get 50 PDFs for 50 Users
i think thats the best solution
since the number of files is too big to extract it as 1 pdf with 2000 pages or printing 2000 pages on time
so the best solution will be output requests for every user separate as 1 pdf named as user name
so at the end i will get 50 PDFs for 50 Users
i think thats the best solution
Separate i mean extracting all files per user as 1 pdf
i told u before, every user might have 20 requests ( let's say it's 20 ) and i have em in Files table as paths , so i want to extract em as 1 pdf having 20 pages ! named as user name !
and this operation looped for every other user
so at the end i will get 50 Pdfs named as user names, and every PDF have 20 Pages!
that's what i mean with separate, i don't mean to keep em separate as 1000 pdf separate!
I gave the code a try the other day just to see if it will work, and it did. You will get a warning message from Adobe if you try to merge fillable forms, but they'll merge anyway. Otherwise, yes, you should be able to use it in your project. The only thing I don't like about the function is it expects an Array, so you'll have to create one first, which isn't really hard. However, I would have preferred the function to use a ParamArray or a CSV argument instead. Cheers!
I gave the code a try the other day just to see if it will work, and it did. You will get a warning message from Adobe if you try to merge fillable forms, but they'll merge anyway. Otherwise, yes, you should be able to use it in your project. The only thing I don't like about the function is it expects an Array, so you'll have to create one first, which isn't really hard. However, I would have preferred the function to use a ParamArray or a CSV argument instead. Cheers!
Probably, the easiest way for you to create the array for that function is by using my SimpleCSV() function to combine all the file names into one string. Then, you can use the Split() function to create the array for the merge PDF function. Hope that helps...
Probably, the easiest way for you to create the array for that function is by using my SimpleCSV() function to combine all the file names into one string. Then, you can use the Split() function to create the array for the merge PDF function. Hope that helps...
I've checked ur SimpleCSV() function , and you teched me something new today. thanks for that
what I learned is Arrays is working like Dim xx as strings or integers, but without sizing
and with your SimpleCSV function, it concatenates all file paths to 1 very big string
and with Split function we can split it with "," so every file path will be separated again
so the final output is :
the result as u can see , 4 file paths ( 2 file paths for every user) - see the table
SQL:
Private Sub Command27_Click()
Dim i As Integer
Dim LinksArray() As String
LinksArray = Split(SimpleCSV("SELECT Files.xLink FROM Files WHERE Files.fType In('xID','Passport')"), ",")
For i = LBound(LinksArray) To UBound(LinksArray)
'looping through array here
Debug.Print LinksArray(i)
Next i
End Sub
Now with the button code to merge pdfs from this link
SQL:
Sub Combine_PDFs_Demo()
Dim strPDFs(0 To 2) As String
Dim bSuccess As Boolean
strPDFs(0) = "C:\Users\Ryan\Desktop\Page1.pdf"
strPDFs(1) = "C:\Users\Ryan\Desktop\Page5.pdf"
strPDFs(2) = "C:\Users\Ryan\Desktop\Page10.pdf"
bSuccess = MergePDFs(strPDFs, "C:\Users\Ryan\Desktop\MyNewPDF.pdf")
If bSuccess = False Then MsgBox "Failed to combine all PDFs", vbCritical, "Failed to Merge PDFs"
End Sub
So what i don't understand now
1- how to edit this code^ to get file paths from LinksArray(i)
2- how to get 1 merged pdf for every user ? the output i expected from this example should be Mike.pdf ( 2pages ) and peter.pdf ( 2 pages )
I've checked ur SimpleCSV() function , and you teched me something new today. thanks for that
what I learned is Arrays is working like Dim xx as strings or integers, but without sizing
and with your SimpleCSV function, it concatenates all file paths to 1 very big string
and with Split function we can split it with "," so every file path will be separated again
so the final output is : View attachment 81800
the result as u can see , 4 file paths ( 2 file paths for every user) - see the table
SQL:
Private Sub Command27_Click()
Dim i As Integer
Dim LinksArray() As String
LinksArray = Split(SimpleCSV("SELECT Files.xLink FROM Files WHERE Files.fType In('xID','Passport')"), ",")
For i = LBound(LinksArray) To UBound(LinksArray)
'looping through array here
Debug.Print LinksArray(i)
Next i
End Sub
Now with the button code to merge pdfs from this link
SQL:
Sub Combine_PDFs_Demo()
Dim strPDFs(0 To 2) As String
Dim bSuccess As Boolean
strPDFs(0) = "C:\Users\Ryan\Desktop\Page1.pdf"
strPDFs(1) = "C:\Users\Ryan\Desktop\Page5.pdf"
strPDFs(2) = "C:\Users\Ryan\Desktop\Page10.pdf"
bSuccess = MergePDFs(strPDFs, "C:\Users\Ryan\Desktop\MyNewPDF.pdf")
If bSuccess = False Then MsgBox "Failed to combine all PDFs", vbCritical, "Failed to Merge PDFs"
End Sub
So what i don't understand now
1- how to edit this code^ to get file paths from LinksArray(i)
2- how to get 1 merged pdf for every user ? the output i expected from this example should be Mike.pdf ( 2pages ) and peter.pdf ( 2 pages )
So now, you just pass the array to the function when you call it along with the name of the final merged file you want to have in the end. So, it might be something like:
So now, you just pass the array to the function when you call it along with the name of the final merged file you want to have in the end. So, it might be something like:
Sub Combine_PDFs_Demo()
Dim bSuccess As Boolean
Dim strPDFs(0 To 2) As String
strPDFs(0) = "C:\Users\Ryan\Desktop\Page1.pdf"
strPDFs(1) = "C:\Users\Ryan\Desktop\Page5.pdf"
strPDFs(2) = "C:\Users\Ryan\Desktop\Page10.pdf"
bSuccess = MergePDFs(strPDFs, "C:\Users\Ryan\Desktop\MyNewPDF.pdf")
If bSuccess = False Then MsgBox "Failed to combine all PDFs", vbCritical, "Failed to Merge PDFs"
End Sub
and i've revised the topic
If it fails, it will return False. There are a number of reasons the function could return False, but two of the most common reasons are:
One or more of the PDFs you defined in arrFiles doesn’t exist. If that’s the case, the macro will continue to combine the existing PDF files, but it will skip over the non-existent files (of course).
You don’t have Adobe Acrobat installed on your computer or you haven’t added a reference to the “Adobe Acrobat X.0 Type Library.” It’s important to note that just because you see an Adobe Acrobat X.0 Type Libray in your references, it doesn’t mean you have Acrobat installed. You may just have the Reader installed, in which case the macro won’t work.
and the 2 points is valid on my end
and Still , this code even if it works , it will merge all file paths to only 1 file !!
and that's not the output i want !!
the output i want must be: [Username].pdf as
Mike.pdf ( 2 pages )
Peter.pdf ( 2 pages )
at Desktop
i want to click a button and it get file paths form the table based on every ID , and saves it in desktop on 1 PDF file named by Username equivalent user id
Sub Combine_PDFs_Demo()
Dim bSuccess As Boolean
Dim strPDFs(0 To 2) As String
strPDFs(0) = "C:\Users\Ryan\Desktop\Page1.pdf"
strPDFs(1) = "C:\Users\Ryan\Desktop\Page5.pdf"
strPDFs(2) = "C:\Users\Ryan\Desktop\Page10.pdf"
bSuccess = MergePDFs(strPDFs, "C:\Users\Ryan\Desktop\MyNewPDF.pdf")
If bSuccess = False Then MsgBox "Failed to combine all PDFs", vbCritical, "Failed to Merge PDFs"
End Sub
and i've revised the topic
If it fails, it will return False. There are a number of reasons the function could return False, but two of the most common reasons are:
One or more of the PDFs you defined in arrFiles doesn’t exist. If that’s the case, the macro will continue to combine the existing PDF files, but it will skip over the non-existent files (of course).
You don’t have Adobe Acrobat installed on your computer or you haven’t added a reference to the “Adobe Acrobat X.0 Type Library.” It’s important to note that just because you see an Adobe Acrobat X.0 Type Libray in your references, it doesn’t mean you have Acrobat installed. You may just have the Reader installed, in which case the macro won’t work.
and the 2 points is valid on my end
and Still , this code even if it works , it will merge all file paths to only 1 file !!
and that's not the output i want !!
the output i want must be: [Username].pdf as
Mike.pdf ( 2 pages )
Peter.pdf ( 2 pages )
at Desktop
Hi. It all depends on the array you pass to the function. It will merge all the PDFs you pass to it. So, if you don't want all your PDFs merged into one, then only pass the ones you want merged. So, when you loop through your data and use the SimpleCSV() function, make sure it's only passing the necessary PDFs to merge for each client - not the entire table. You should be able to do that by using a Where clause to filter the data to a specific client/record.
Hi. It all depends on the array you pass to the function. It will merge all the PDFs you pass to it. So, if you don't want all your PDFs merged into one, then only pass the ones you want merged. So, when you loop through your data and use the SimpleCSV() function, make sure it's only passing the necessary PDFs to merge for each client - not the entire table. You should be able to do that by using a Where clause to filter the data to a specific client/record.
Hi. You "do" want to filter the data - as you merge the PDF. You would only do it within the SimpleCSV() function. Otherwise, you will have the same merged PDFs for every record. For example, let's say you have 3 names with 2 PDFs each, then you want to loop through the 3 names and "filter" the PDFs for each name before merging them. This is the same principle as when we were "printing" the PDFs. We didn't want to print all the files for each name, we only needed to print the ID and photos. So, we "filtered" the data to exclude other PDFs we didn't want printed.
Hi. You "do" want to filter the data - as you merge the PDF. You would only do it within the SimpleCSV() function. Otherwise, you will have the same merged PDFs for every record. For example, let's say you have 3 names with 2 PDFs each, then you want to loop through the 3 names and "filter" the PDFs for each name before merging them. This is the same principle as when we were "printing" the PDFs. We didn't want to print all the files for each name, we only needed to print the ID and photos. So, we "filtered" the data to exclude other PDFs we didn't want printed.
That's true
But till this point i've reached i don't know how to continue or do what you telling here in this quote
so here is the equivalent of your simpleCSV() function based on the File Table
SQL:
SimpleCSV("SELECT Files.xLink FROM Files WHERE Files.fType In('xID','Passport')")
If i may ask you to make the edits on sample DB on your reply here and change print code to let it only extract PDFs as 1 merged file per user and file named by username and delete filter by used name !
i need to get all file for all users if i didn't choose a user