Jump to content

Pdf creator copy from excel clipboard to name file


Recommended Posts

This is what I want to do:

When I run the autoit script I want it to name a PDF file to whatever I have in a cell reference when using excel.

I will be using this script in excel to complete the printing process.

As you will see below , I have the information saved to the clipboard but have been stuck at this point.

Sub PDFsave()

Application.CutCopyMode = False

Application.EnableEvents = False

Dim cname, invnum

Dim fpath As String

fpath = "SHEET NAME"

With Worksheets("Sheet1")

invnum = Range("A1").Value

cname = Range("A2").Value

FDate = Format(Range("A4"), "ddmmyy")

Range("A5").Value = invnum & " " & fpath & " " & cname & " " & FDate & ".pdf"

Range("A5").Select 'send to clipboard

Selection.Copy

End With

Application.ActivePrinter = "PDFCreator on Ne00:"

Activewindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _

"PDFCreator on Ne01:", Collate:=True

'code here to run AutoIt

End Sub

Any ideas?

Link to comment
Share on other sites

I worked it out.

all I had to do was place this code after the printer pops up.

Range("A5").Select 'send to clipboard

Selection.Copy

PS. This script in this post is NOT for Autoit, it is VBA script.

>>>> This Post is Closed <<<<

Edited by ilearnautoit
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...