VBA To Print Sheet To PDF And Save Using Name In Cell

Jan 7, 2010

I'm trying to create a macro that will print the active sheet to PDF, and automatically save it using the contents of cell B3.

Sub SavePDF()
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, ActivePrinter:="Adobe PDF"
Dim filename As String
filename = Range("b3").Value
End Sub

It seems to do what I want, except name it using the contents of B3. I have very limited VBA knowledge. I've searched for this, and it seems many others are trying to accomplish something similar.

B3 is a formula that will display alpha-numeric characters (such as C0123456). I copied the cell and used paste special>value thinking that may have been preventing it from automatically saving the file as "C0123456", but it still didn't work.

The sheet will always be 2 pages, and I think the code will always ensure Adobe PDF is selected as the printer.

View 9 Replies


ADVERTISEMENT

VBA To Print Active Sheet To PDF Auto Save In Specific Folder Then Mail Using Outlook

Jul 17, 2014

How do I write a vba code to print active sheet to pdf, auto save in specific folder then mail using outlook

im using 'Nitro PDF Creator'

also id like it to automatically save the pdf as the same file name as the active worksheet and also auto enter the following when opening the email server:-

Address: Cell D18
Subject: Cell D21
Email body:

find attached quotation

Optional installation available on request

View 2 Replies View Related

Macro To Print Sheets With Value In Cell A1 But Print Dynamic Ranges On Certain Sheet

Sep 24, 2013

I've found some code which works to print certain pages with value in cell A1 but I need to print dynamic ranges on some of the sheets as they will have filters on so the rows ranges will be different each time.

So far this is what I have but the dynamic range part is not working:

VB:
Sub Print_All_Worksheets_With_Value_In_A1()
Dim Sh As Worksheet
Dim Arr() As String
Dim N As Integer

[Code] ....

View 3 Replies View Related

If Data Is In Cell Copy To New Sheet And Print New Sheet?

Jun 13, 2014

Ok so i have 2 sheets. Sheet 2 is a form that needs to be printed.sheet one will have data pasted into it by the user. The data will be placed in column a and b. If a has data in it then so will b. Now I need the macro to identify if data is in a then the macro needs to then copy a and paste special into A18 on sheet2 then copy b and paste into A6 on sheet2 then print sheet2. Repeat this process to every row as long as A has data in it.

View 3 Replies View Related

Allow Users To Print Hidden Sheet But Not Change Print Settings

Jul 2, 2009

I am having trouble disabling the "Preview" button when calling Application.Dialogs(xldialogprint) in XL2003. I have an xlSheetVeryHidden worksheet containing a form which is made visible programatically when the user wishes to print a copy (code below). I want the user to be able to have access to the functionality of the xlDialogPrint dialog (i.e. select desired print destination, number of copies, pages per sheet etc.) but I also want to prevent them modifying the page setup of the protected worksheet by initiating a preview from the print dialog.

Private Sub btnPrintReturnForm_Click()

wbkRUSC.Unprotect sysPass 'unprotect workbook to enable changes to sheet visibility
' (sysPass is project constant string containing password)

shtStaffForm.Visible = xlSheetVisible 'make staff form visible

shtCalc.Visible = xlSheetVeryHidden 'hide main calculator in case user gets smart and hits..............................

View 5 Replies View Related

Increment Cell Value At Each Print Of Sheet

Jun 25, 2008

Basically I have a sheet that changes it's values depending on the value in C2. What I'd like to create is a loop that prints the sheet, increases the value of the cell by one, prints the sheet again and so on. Before printing I'd like to check that the value of e.g. B5 is not equal to zero.

View 3 Replies View Related

Increment Cell Value & Print Sheet At Each Step

Mar 14, 2008

I am trying to automatically increment a cell value then print the sheet. I need it to increment up to 220, or possible higher, and then print at each increment; 1,2,3,etc. as opposed to typing 1 then print, 2 then print, 3 then print...etc. Can this be done with a macro? I've attached a file if you want to view it (cell J2 of "NEW PART ENTRY" sheet).

View 8 Replies View Related

Macro To Print Specific Sheet If Name Appears In Cell

Nov 13, 2013

I am trying to print one of the Sheets in my Workbook by looking at a specific cell that can have one of the sheet names.

View 7 Replies View Related

Save & Re-Use Print Settings

Feb 15, 2010

Is there a way to force a print RANGE, and add settings such as margins, and print to range to 1 page wide and 1 page tall? Can this be set with VBA? I tried to make a marcro but it crashes. This is for Excel 2002.

View 9 Replies View Related

Print To Pdf - Auto Save As

Jul 11, 2007

I have code to print an invoice to PDF, here is the printing part.

Sub Macro3()
Application.ActivePrinter = "Adobe PDF on Ne05:"
ActiveWindow.Worksheets("Sheet1").PrintOut From:=1, To:=1, Copies:=1, ActivePrinter:="Adobe PDF on Ne05:", Collate:=True
End Sub

When the code runs a box appears asking the user to save the PDF as a filename and the user never saves the correct invoice filename. Is there a way to suprees the box and automatically save as a predetermined name say "Invoice 0012 27-01-01"

View 8 Replies View Related

Save Previous Cell Value In The Corresponding Row Of Different Column In Same Sheet

Apr 4, 2014

I found some VBA code that saves the previous value entered into a cell and displays it as a comment. I've attached that workbook as an example, but I want to change 3 things.

1) I only want to capture the previous values from Sheet1.Column1 (you'll see the example captures changes on the whole sheet1).
2) I want to 'paste' the previous value of Sheet1.Column1 in the corresponding row of Sheet1.ColumnD (i.e. the previous value of A5 will be displayed in D5). The code currently pastes the value in the corresponding address in sheet2.
3) I do not need the comments part. Simply displaying the previous value in the corresponding row of Sheet1.ColumnD is good enough.

View 2 Replies View Related

Export To New Workbook And Save Print As PDF

Jan 2, 2012

I have a spread sheet called "Quote" I have 3 command buttons in this worksheet.

"CommandButton1_Click()" is "Create Quote"
"CommandButton2_Click()" is "Home"
"CommandButton3_Click()" is "Create Client Quotation

I would like to be able to add another command button to export the worksheet "Quote" to a new work book and then automatically print it to a PDF naming the file from the next available quotation number in directory I:Quote register.xls. is it possible to find the next available number by finding the next blank cell in column B in the above directory I:Quote register.xls?

I would like it to copy the Create Client Quotation Macro to the new workbook if possible. The other 2 command buttons are not relevant after the export.

View 7 Replies View Related

VBA Copy From Sheet To New Workbook And Save As From Name In Target Cell Then Loop

Aug 27, 2012

I need VBA code for the following - I have a worksheet with seven colums of data (A to G) - I need to copy the first column (A) from the active worksheet then open master workbook called 'master' and paste the data in to column D - then save the 'master' as the name in cell Z1 of the 'master' workbook. Once this has been been completed I need to repeat the process but this time copying column (B) and so on.

View 4 Replies View Related

Excel 2007 :: Cell Show No Value When Open Sheet On Another Computer - Value Appears When Save Again

Mar 13, 2014

when I open my sheet on another computer, all cell value which contain formula show no value. just blank. formula is link to same workbook on different tab. when I save as again on my desktop, all value appears. excel 2007 is using.

View 3 Replies View Related

Print A Border Around The Entire Sheet No Matter How Many Rows Are In The Sheet

Aug 28, 2008

I have a sheet that I want to have a double line border around the outside. Thats easy if there were a set number of rows but in my sheet the number of rows will depend on the size of the rows because of the different amount of information in each cell. So how do I make it print a border around the entire sheet no matter how many rows are in the sheet??

View 9 Replies View Related

Extract Each Sheet To Text File & Save As Sheet Name .txt`

Jun 9, 2007

provide me a code for extracting data and outputting it into individual worksheets situated within the excel workbook file. I am wondering what the code would be if the data were extracted to individual text files, individual workbooks or *.prn files?

For i = 2 To Cells(Rows.Count, 1).End(xlUp).Row
Set ws = Worksheets.Add(After:=Worksheets(Worksheets.Count))
ws.Name = wsraw.Cells(i, "D")
With ws
.Range("A1") = wsraw.Cells(i, "D")
.Range("A2").Resize(2) = wsraw.Cells(i, "A")
.Range("B2").Resize(2) = wsraw.Cells(i, "B")
.Range("C2") = 0
.Range("C3") = 1000
.Range("A4") = -999
End With
Next

View 2 Replies View Related

Save Each Worksheet As PDF File And Name Each File Based On Cell Value In Each Sheet

Jul 10, 2014

I have a Workbook that already has a macro in it that will generate multiple sheets based on certain criteria.

For each of these newly generated sheets (numbered 1-6 in the attached example), I need to be able save each of them to a PDF file based on a unique name contained in a certain cell (in this case, each named is referenced in cell Q1 of each sheet). As such, I should end up with 6 pdfs based on the attached sample files.

The PDFs would ideally need to be landscaped and should be just 1 page per sheet.

In my attached sample workbook, you'll notice that I have a "PracticePrint" macro that doesn't quite get the job done. One other criteria involves not printing any sheet with the characters "1010" in it (my PracticePrint macro is setup to do that, but it fails to do much else).

View 1 Replies View Related

Copy From One Sheet To Another Sheet Then Save In Another Workbook

Apr 9, 2014

have a basic knowledge of VBA. The task I am trying to perform with VBA is to

1. Copy from sheet1 A1 to sheet2 E9
2. Copy from sheet1 B1 to sheet2 E11
3. Save sheet2 in a new workbook file with the file name cell data from sheet1 A1 (511894.xls)
4. Copy from sheet1 A2 to sheet2 E9
5. Copy from sheet1 B2 to sheet2 E11
6. Save sheet2 in a new workbook file with the file name cell data from sheet1 A2 (097219.xls)
7. Repeat the process down columns A and B to the end of the columns.
8. Columns A and B will end at the same time but the data and the last cell will change with each scan added to the columns.

This code will accomplish this task with a single column of data but not two columns. Also column B will have a mixture of numbers and letters in its cells, Column A is only numbers.

VB:
Sub MoveData()
sName = "temp"
Const csPath As String = "C:Documents and SettingsmcgaulcDesktopTestFile"
'MyName = ActiveWorkbook.Name

[Code].....

Here are some images of the data sheet and the saved sheet

Sheet1.jpg Sheet2.jpg Note: sheet2 in image is "temp" sheet in code

View 7 Replies View Related

How To Print By Sheet Name

May 24, 2013

I have a spreadsheet with approx. 100 sheets, 1 sheet for each customer. The tabs are named by customer number, formatted ###.## where the 3 digit code represents the country and the two digit code represents the customer. For instance, the country code for France might be 001 so the customer accounts in France would be 001.01, 001.02 etc.

We have 4 area managers over various countries, and I'm trying to create a macro that would allow me to print all of the customer statements relating to a certain manager. For instance, manager #1 manages 5 countries, their codes being 001, 023, 057, 101 and 109. How can I code a macro to look at all sheet names that begin with either 001,023,057,101 or 109 and print those sheets?

I have a table in a separate sheet that has all customer numbers, customer names, country and area manager...

View 5 Replies View Related

Print To PDF As Name Of Each Sheet

Apr 23, 2012

I have a spreadsheet exported from Access that contains each department's budget information (used, remaining, etc.).

I want to create a command button that when clicked will create a separate PDF for each worksheet. I want each .PDF file to be named the same as the Worksheet name.

View 3 Replies View Related

Using Macro To Print Sheet

Jan 13, 2010

I am using a macro with the code below to print the active sheet.

Sub MyPrintOut()
ActiveSheet.PrintOut
End Sub

I assigned the macro to a rectangle. My only problem is that when i print the sheet i can see the rectangle, is there a way around this? I know that i can set the print area but each sheet has a different setup, i tried using .Visible = False for the rectangle but it gave me a few errors.

View 2 Replies View Related

Trying To Print Hidden Sheet

Jun 24, 2014

I have protected a workbook with a hidden sheet. I am trying to save the hidden sheet to a .pdf format.

It works well until I hide the sheet. I see from other post that the .select is a big part of my problem but I'm not sure how to get around it.

View 11 Replies View Related

How To Print Value In Another Sheet Instead Of Showing In Msg Box

Mar 7, 2014

I prepared this code for calculate row count. Here I am showing the result in msg box. But I want to store/place this value in another sheet.

Sub myrows()
Dim rows As Single
rows = Sheet1.UsedRange.rows.Count
MsgBox (rows)
End Sub

View 6 Replies View Related

Print The Multi Sheet

Mar 3, 2009

I know that there is an easier and shorter way of doing this;

View 6 Replies View Related

Print Selection Fit 1 Sheet.

Oct 24, 2009

i have a buttion on a whole heap of worksheets that is linked to this sub. I want it to print the range on one sheet of paper. though it will print over 4 sheets.

View 2 Replies View Related

Print VBA Array To A Sheet?

Jul 11, 2013

I have an array and I want to graph it. I don't know how to do that so I am trying to print it to a sheet and graph the data that way.

This is my array:

blkhist(service, 1) = DateDiff("d", blkstart, rawdata(currentdate, 1)) 'x axis values
blkhist(service, 2) = rawdata(currentdate, 16) ' y axis values
blkhist(service, 3) = blkcart 'series #

View 9 Replies View Related

Code To Print Sheet

Nov 27, 2007

I have 7 digit values in Col B12: down. I have sheets with names that match any one of these values. Is it possible for a macro to print all sheets in my workbook whose name matches one of the values in Col B cells 12:down??

View 9 Replies View Related

Print Sheet To One Page With Button?

Mar 29, 2013

I have a sheet that I would like to print to one page (11x17, landscape) and have it take up the majority of the page. The largest the sheet will ever be is data in rows 1 - 71, and columns A - AC. Right now I have it set up so that when i click on the button, the print dialog opens up and no adjustments are needed to print to pdf in 11x17 for the maximum amount of data.

Overall what I am trying to do is have the zoom change when rows are deleted (columns will always be A-AC). The top 5 rows and bottom 5 rows will always be there. I want the top and bottom margins to be the same on the pdf even if 10 rows are deleted in between.

View 1 Replies View Related

Print A Sheet With Incremental Overlay #

Oct 22, 2008

Basically Im crap at excel and need to start learning the in's and outs more but I have drafted up a double sided spreadsheet that I would like to run a series of prints 'inhouse'

I would like it if I could insert an overlay serial number on the sheet that would enable me to carry out future prints adding an incremental number to the serial number EG printing off 100 prints where the serial number runs from

CODA/BL1_00001
CODA/BL1_00100

IS this possible using general tool tricks of the day ie VB, macros or does an add on program exist that will enable this to be generated on a fly between the program and the printer.

View 13 Replies View Related

Get Copy Of Contents On Next Sheet Whenever Print Is Taken

Jul 11, 2014

I need a macro to have the copy of selected cells on sheet1, and paste it on sheet2 of the same workbook, whenever I take the print of the sheet1. My requirement is that Each time when I take the print, the selected items get pasted simultaneously on next available cells on sheet2.

Example of my worksheet is attached : Example.xlsx‎

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved