Hi guys, I'm new here and really don't know where to post my question. Although this involves VBA, my question is more about renaming and moving a file in Explorer.
Mods please feel free to delete my post. (or move to the correct forum).
In Word, I've got a VBA that prints the active document to a specific printer. It's actually a virtual printer that can convert the Word doc into a PDF. And yes, I do realize that Word has a built-in feature to "Save As PDF" already. I need to print to this virtual printer for a specific reason and I don't want to get into the technical reasons right now.
The virtual printer and the VBA routine works just fine. However, it always creates the PDF file as:
"Microsoft Word - something something.docx.pdf"
The virtual printer always takes on the name of the application (in this case MS Word) and puts that the very beginning of the filename as shown in my example. I really don't like all that extra stuff in the filename. Is it possible to have a VB script that can remove whatever appears before the actual filename and remove the file extension that appears before the "*.pdf" portion that the end result looks like this?
"something something.pdf"
I would like for the VB script to work for all Windows applications. Sometimes I need to print to this virtual printer in MS Notepad and the output looks like this:
"Microsoft Notepad - something something.txt.pdf"
I have this virtual printer programmed so that it generates the PDF files to a default location:
E:\Ghost PDF output\
After the file has been renamed, I'd like for the script to move the file to one of these 3 locations:
E:\Personal Archive\Converted Files
E:\Personal Archive\Correspondence
E:\Household\My projects
Would it be possible to have a drop down list or a radio style menu option where I can choose from 1 of the 3 and have the script move it there?
I'm running Win7 (64-bit) and MS Office 2010 (64-bit).
Any help would be greatly appreciated.
Mods please feel free to delete my post. (or move to the correct forum).
In Word, I've got a VBA that prints the active document to a specific printer. It's actually a virtual printer that can convert the Word doc into a PDF. And yes, I do realize that Word has a built-in feature to "Save As PDF" already. I need to print to this virtual printer for a specific reason and I don't want to get into the technical reasons right now.
Code:
Sub MyPrint()
Dim sPrinter As String
With Dialogs(wdDialogFilePrintSetup)
sPrinter = .Printer
.Printer = "Ghost PDF Printer"
.DoNotSetAsSysDefault = True
.Execute
Application.PrintOut FileName:=""
.Printer = sPrinter
.Execute
End With
End Sub
The virtual printer and the VBA routine works just fine. However, it always creates the PDF file as:
"Microsoft Word - something something.docx.pdf"
The virtual printer always takes on the name of the application (in this case MS Word) and puts that the very beginning of the filename as shown in my example. I really don't like all that extra stuff in the filename. Is it possible to have a VB script that can remove whatever appears before the actual filename and remove the file extension that appears before the "*.pdf" portion that the end result looks like this?
"something something.pdf"
I would like for the VB script to work for all Windows applications. Sometimes I need to print to this virtual printer in MS Notepad and the output looks like this:
"Microsoft Notepad - something something.txt.pdf"
I have this virtual printer programmed so that it generates the PDF files to a default location:
E:\Ghost PDF output\
After the file has been renamed, I'd like for the script to move the file to one of these 3 locations:
E:\Personal Archive\Converted Files
E:\Personal Archive\Correspondence
E:\Household\My projects
Would it be possible to have a drop down list or a radio style menu option where I can choose from 1 of the 3 and have the script move it there?
I'm running Win7 (64-bit) and MS Office 2010 (64-bit).
Any help would be greatly appreciated.