Begin just make sure you subscribe to our channel and hit the bell icon to stay updated with our latest videos let's get started in this section we're going to quickly learn how to publish the documents to PDF here are my sample files the excel file the PowerPoint and the word document first I'm gonna go to my Visual Basic for Excel insert a new module let's call this publish to PDF.
Game output file that string this output file is gonna hold the pot and the name of the file so this workbook dot name this will return us the name of the workbook but from there we just want to take the name of the file so I'm gonna tail left this work dot name and from there I'm gonna take the land and subtract minus 5 this will just give us.
The name of the file without the extension and here I'll just add dot PDF okay that looks good along with in the amount of file we want to include the name of the workbook part as well okay that looks good this will be the name of our final file I'm gonna copy that output file name is equal to this workbook part and this workbook that name and changing that xlsm to PDF.
Okay now we'll write the source State one more statement to publish this kid one is what I want published so say export is fixed format the format will be PDF the file name here is gonna be the output file and quality can be Excel quality standard you can you know include all these properties some of the application will have a wide variety so it should be okay even if you do not include them here some of them are.
Ignore print areas you can specify if you want to export from certain page from page 7 to 8 for an example or if you want to open them after it's being published so I'll just leave it as it is for now I'm gonna run this code once it completes we'll expect the file to be exported into this folder publishing it now seems to be working okay and here's.
My PDF file quickly opening it this probably is 38 pages very smoothly okay now we're going to quickly replicate this for Word documents and PowerPoint first I'm gonna go to my PowerPoint again insert a module the name is gonna be same instead of this workbook let's do active presentation and here instead of one we want to export if I devote this now for example.
So it's giving us vbe underscore PDF dot PDF so it seems to be working ok now we'll publish this PowerPoint to video active presentation dot export as fixed format it will take in first as a file pot let's copy the output file pod paste it here this will be again PDF and then you can intend for print and it is white again it's white variety is a properties I'll just leave it as it is for now to default so once I run this code it's.
Gonna publish again to to the destination folder here publishing it and here is a file ok so finally we'll gonna Google do this for our word document so bezel basic from this document I'm gonna insert a module call it instead of this workbook we can say this will be active document I'll replace this workbook with active document and here instead of sheet one.
We'll have to use active document again it's pretty much the same thing but to give you a better idea this will be the file pod and then we can say exported format as PDF and do you want to open after it is published I'll just say yes for this one straight out so once this is published it will open up a PDF file itself oh yeah seems to be all working fine.
Let's also learn how to quickly create a PDF form I'm starting off Adobe Foam central so once you open you'll see a wide variety of forms that you can utilize to replicate the phone it's very simple to create them for now let's create a custom phone here are the controls and objects that you can add to your phone like a text box and so on we're gonna add a text box to text box.
Posts Related:
- Scheduling And Activating Your Workflow
- Best Infographic PowerPoint Slide Design Tutorial Thin Line Infographic Scheme With 6 Options
- Export bulk data to Excel using from database - Oledb .NET E12
And let's call this the first name and the last name you can also easily change
The type later on also now I'm going to add the email ID it has the controls and validation in place already let's add a quick like a survey option or call this are you satisfied with our services or something like that you can change the preset and color and everything whenever you have time you can play more with that let's add the.Date field as well we're gonna use all this field later to read and writes or add different type of fields here in the phone so this can be like a report date yeah a survey did well at the header let's call this custom phone maybe maybe it is a demo I think that's pretty much it so it's very simple to create a PDF form you can also change the name of the.
File from the top there called demo and as I've said you can quickly change the validation the type of the text box the number types and so on it's very simple before we start writing the code let's quickly copy the file path and now I'm gonna create a new workbook let's insert.
A new module and create a public constant variable called PDF underscore file and we'll store our file path here we'll create a sub procedure called read from PDF and before we start writing the code we'll reference it to Adobe Acrobat library just make sure you reference it to the latest version I have 10.0 there.
Now let's start declaring variables the app will be our acrobat application every document this will be our acrobat viewer now let's replicate this for PDF dog this will be PD dog and select X variable again all these are object variables in the page we're gonna select the text later this is for the page corner and the text corner we're going.
To look through later on we're gonna use this and then this will be the page numbered content page content and the content itself within the page now let's set the variables creating object we'll create an object for a VAR every duck as well now we'll open the PDF document adding a.
Quick handler in case if it fails to open it'll exits up now we'll try to reference and get the active document in this slow I'm gonna add a reference to get the active document from the application yep okay now I'm gonna reference this PDF RP a PDF underscore dog to the AV dog then we'll be exposed.
To the methods from the from the AV dog for PDF doc now I'm gonna look true from for all the pages the counter start from zero we'll have to subtract one from the pages so within this loop we're gonna reference I will create this page page number content and and so on okay.
Creating an object again for our page content this is this particular object is basically gonna highlight highlight tags or contents within the page and then we'll discounters is basically we're selecting all the text from 0 to 9,000 you might want to add more if your page have more contents adding a quick error handler in case it returns an error when we try to select the text.
Within the page
Select Isis using the page highlight page content from the page content okay now we'll start looping through all the all the text within from the selection or j.j counter is going to take care of that again looping from 0 till all the total and let's print this value to our immediate window that's pretty much it.Our we're gonna review it later after we write everything let's quickly clean the memory so make sure that once it finished running it clears out the memory so the next time it runs it's okay we're gonna close the PDF document there without saving it false stands for that we're gonna exit the application and then we're just gonna set all these variables to nothing all the object variables.
So I keep on compiling there just to make sure that it compiles okay though these are hard party API so it might even if it compiles okay maybe it will not be 100% working but then we'll have to run and test it out quickly we'll have to change this from read from PDF the typos and looks like we have to add it should be yeah it should be pitched content dot add ok so let's quickly check out our code.
And make sure it's working I'm gonna quickly turn on the immediate window and try to run this code so I'm gonna hit f8 and quickly go through the code so it's starting to print out the data from PDF okay I'm gonna run the rest of the code let's extract all the data but since it's too much of data really doesn't make sense we print it out here in a mediate window let's try to transfer the same data to the to the worksheet here.
Just say range let's print this out to column a okay I think that should do I'll call this PDF and I'm gonna execute this it's super quick it extracted all the data now I'm gonna quickly open the PDF file and do a quick recon so as you.
Can see here the top flows report and the date is here in the PDF and then the Adobe Acrobat is this the paragraph starting from here and then so on so as you can see the data that is being pulled from PDF is not coming index format that we need so in the following video we're gonna put in some additional logics to pull in data from the table from this particular PDF in our last video we'll learn how to read all the contents from PDF now I'll.
Show you how to pull records from PDF table into your worksheet first of all we're gonna identify some of the unique strings that begins and ends in the table for example our unique string could be below are the top five and flows for the week or it could be the UID and it can be high-level observations here that we can use to create a logic so based on these two strings will end a number of the columns.
Which is here we can see four columns so based on this will create our logic in to pull in the data coming to our ID here I'm gonna quickly copy this all this code insert a new module this time I'm gonna call this read table here we're going to introduce some variables let's call this data print let's call.
This when we want to print or not this will be true or false and then the counter for our column stories in a long value and then the current row okay this will be our three new variables learn how to use that now so coming down here we'll say content our content is gonna be this data that is pulling in from I'll just comment.
This out for now here I will say if the content value is like something like UID which it is then I want to start printing the value or writing the values to the excel then I'll say that else if the content is like high that's when I want to stop printing it so I'll say.
Data print go to false and then I'll just stop printing altogether exit from the loop itself it's also exit for now we'll start writing a logic to print the data if this is true this condition is met so we'll say if printer is called it true then just increase the corner : and we'll see cells or whatever the.
Role that is defined will start printing from this row row number one and then the column and they will say print the contender this loop is going to take care of for each of the column now we have to reset the column once it reaches for contra is equal to 4 because we have four columns now every time he reaches for I want to reset for the next line.
Column is for 10 on its call to zero so every time we reach here it will start with 1 again and then we'll increase the Rock honor as well once it reaches 4 okay I'll code should be working fine now quickly go true I'll run through this I'll just put a breakpoint there and run this at 5 so now I'm gonna press f8 seems a breathing print out the headers and then now the.
Data since we print it out maybe not in the format I'm gonna run trolled us now first f5 okay so there are some cleaning that is required okay coming back we'll clean this content the same axle trimmed and then we'll clean as well because there is like a new line there.
This is a clean function within the clean mode put the trim as well I'm gonna rerun this quote very quickly now the data seems to be good so the date the date portfolio is in general and then this is in number format so if you look at our table here and the table here so it seems to be working great.
The beginning will quickly copy part of the form and we'll create a constant variable let's call this PDF form file and then we'll store this as a string okay now let's reference this to Acrobat phone if on aut 1.0 or whatever it is for you create a sub call rate PDF from Phil's.
Will declare that Acrobat app let's do this for Acrobat viewer the same as a document we'll have to use both the form as well as the document together now we'll start clearing the the form and the fields this will be the field will replicate the same variable for fields later on.
We'll gonna look through all the fields I'm going to create the object for our application we'll do the same for the viewer for the document okay now we can we can open the document we'll put the same validation like we did in the first video.
We'll make sure that it's activated or brought to the front this can be hide our show for noms is gonna hide the application this is gonna run at the back end I'm gonna start creating an object for our phone okay now we'll start referencing our fields within the phone setup the fields okay now we can start looping through all the fields with using this variable.
Seems to compile fine I will try to print out all the valued the name of the field the value within the field and the type of the field so it's better to use words because we're gonna reuse name of the field type of the feel like this is a tax or is it a radio button and so on my email button.
Let's put a bar between each of these fields so the one is printed out it makes sense okay so our code is almost ready though it's gonna just print it out let's close the form without saving it we'll exit the app and then we'll just clear the memory okay since the compiled fine so let's give it a shot wheels gonna just press f8 and go to its line.
Okay seems so open I'll start to print the name of the fields the type and the value at the moment the phone does not have a value so we'll quickly fill out something and we'll try to rerun this let me open the form and just put in put in my name and some dummy ID these two radio buttons will have its two fields and then the survey date I'm gonna save it for now and replace the existing one.
So you can see it's been filtered now we're gonna reorganize the window a little bit and see how it prints out the value as well I'm gonna go through it again quickly I'm just gonna make yeah just comment that out start looking through the fields so you can see the first one is strongly angry there the value of the selection radio button.
Against agree the next one is the email ID first name and name right there and the date to have you know like seems to be working perfectly as we wanted it to be now we'll quickly write this to our sheet instead of the immediate window and then maybe we can also in our next video loop through each of the file and.
Then pull in the data from there for each of the from that corner is going to reset every time the data is being filled and then the value just change the counter of the column column one two entry no I'm gonna run it so so I've pulled in all the data from the phone in our last video we'll learn how to read PDF form and import the field information like the name the name of.
The field the fill type and the value of them of the form now we're going to quickly write another code to fill the PDF form here from Excel itself and then save the phone with a new name and close this for now and just below this we'll start writing a new code well use the same part again let's call this right do you clear the.
App again let's call this [Applause] [Applause] then we'll just reuse this form there's a forum app and then the phone feels and we'll start declaring the name.
Of the fields let's quickly open up the phone so we need the name there's two last name first name email ID two options button and the date so we'll just quickly declare them [Applause] you so this will be our two options button so we're declaring the the fields now.
And now we can start to open up the our document we'll open up this form the same phone you see them on don't see it it's show just carry all this so these are foam and then these are feels don't need this.