Hello,
I just want to thank you for reading this post first of all :wave: :bigyello:
I want to print a pdf file located in a external (P:\) drive, without opening up the file.
I have a userform consisting of 2 buttons and a textbox for user input, a PRINT button and a Load button. lets work with PRINT button for now, aka button1
The user will enter a tex in the textbox field. and click on button1, the code will store that text entered as a string and add the extension .PDF then find that file within the P:\ and send it to the default printer.
Here is what I have so far...
Not sure where this part of code will go, but I'm assuming it will save the text enter in textbox1 as string.
The pdffilename is the text the user will enter and with the click of button1 it will store that as string and should add P:\ AND .pdf extension at the end of it and should replace that part of psi.filename = "P:\pdffilename.pdf"
Sorry if i seem too repetitive but I really want a way to print pdf files, (hundreds of them) via entering the name of the file in a textbox and click on a print button (button1). rather than searching for the file, opening the file, and clicking print, and clicking "ok" to finally print.
Thanks,
Steve.
I just want to thank you for reading this post first of all :wave: :bigyello:
I want to print a pdf file located in a external (P:\) drive, without opening up the file.
I have a userform consisting of 2 buttons and a textbox for user input, a PRINT button and a Load button. lets work with PRINT button for now, aka button1
The user will enter a tex in the textbox field. and click on button1, the code will store that text entered as a string and add the extension .PDF then find that file within the P:\ and send it to the default printer.
Here is what I have so far...
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim psi As New ProcessStartInfo
psi.UseShellExecute = True
psi.Verb = "print"
psi.WindowStyle = ProcessWindowStyle.Hidden
psi.Arguments = PrintDialog1.PrinterSettings.PrinterName.ToString()
psi.FileName = "P:\pdffilename.pdf" ' Need to replace this with a string based on the textbox1 input and add .pdf to the string and the location of it for printing.
Process.Start(psi)
End Sub
Code:
Dim pdffilename as String
pdffilename = Textbox1.Text
Sorry if i seem too repetitive but I really want a way to print pdf files, (hundreds of them) via entering the name of the file in a textbox and click on a print button (button1). rather than searching for the file, opening the file, and clicking print, and clicking "ok" to finally print.
Thanks,
Steve.