printing to XPS and saving XPS "as"

Hi - I have a "save as" macro that I would like to incorporate with my "print 
to XPS" macro.  Can anybody help?

I have this code:
'' Save to XPS  ''''''''''''''''''''''''''''
Application.ActivePrinter = "Microsoft XPS Document Writer on Ne01:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Sheets("Credit History").PrintOut Copies:=1
Application.ActivePrinter = "HP LaserJet P1505n on Ne02:"
'''''''''''''''''''''''''''''''''''''''''''''''''''''

BUT I would like the macro to "save as"  like this macro:


'''''''''''''''''Save To Path Code'''''''''''''''''''''''
    Dim sPath As String
    Dim y1 As String, n1 As String
    On Error Resume Next   'overcoming the error when a direcory already 
exists for MkDir sPath
    
    y1 = Sheets("1").Range("N1").Value
    n1 = Sheets("1").Range("B1").Value
    sPath = "D:\Ayers My Docs\AHS\AHS Credit Spreadsheets\" & n1 & " " & y1

    'make Dir if NOT already there
    MkDir sPath

''''''''''''''''''''''' SaveAs Code '''''''''''''''''''''''''''
ActiveWorkbook.SaveCopyAs sPath & "\" & y1 & Format(Now, " mmm-dd-yy 
hhmmss") & ".xlsm"

MsgBox "Workbook Saved As '" & y1 & "' in folder '" & sPath & "'."
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


How can I print to XPS saving with the same parameters as the above "save 
as" macro?

Thanks for any help - Jim A

0
JimA (42)
6/13/2009 11:43:01 PM
excel 39879 articles. 2 followers. Follow

0 Replies
541 Views

Similar Articles

[PageSpeed] 54

Reply:

Similar Artilces:

Save As without VBA project
After running some VBA code on an Excel file, I'd like to save the file under a different name, but without saving the code. Is this possible? Alternatively I could copy the worksheet into a new file, but I need to keep all the formatting including column widths & row heights. Thanks, Gordon Rainsford Gordon, Your idea to copy into a new file is a good option. The example below assumes a workbook with three sheets. It will retain data and formatting while leaving behind VBA in modules. '----------------------------------- Sub SaveWithoutMacro() Dim int...

Saving one page -- as Template?
Therre are several pages in a 40-page booklet I want to save to use in future editions. Is there a method to save these pages for re-us? Or must I save the entire publication as a Template? Can I copy single pages and paste in another .pub file? Save the entire document and delete out the pages you don't want. -- JoAnn Paules MVP Microsoft [Publisher] Tech Editor for "Microsoft Publisher 2007 For Dummies" "cuig" <cuig@discussions.microsoft.com> wrote in message news:16052168-6085-43D0-AD8B-2CF4839933FC@microsoft.com... > Therre are several pages in...

Printing a Purchase Order to Multiple Destinations
Is it possible to print a PO to a text file on the local machine or network in addition to the local default printer? -- Pete P. It is possible to print a text file to any single location you want in addition to the local default printer. Our system currently prompts users requesting this information. Giving them their choice of 3 formats: Screen Printer File These can be selected in any combination but only one destination per format can be specified. I am hoping that this thread will explain how/if one could deliver one printed report to multiple printers. Eventually I would lik...

cells not right when save as html
When I save my workbook as an html page the formatting on my 45 degree cells at the top of the page are no longer at a 45 degree angle. Is it possible for this formatting? ...

print to file, bypassing all dialogs?
I'm trying to print to file in a production test environment... I'd like to bypass all dialogs. I can get almost all of what I want using a print-to-pdf utility, but I'd like to try doing it all in mfc. I've modified the OnPreparePrinting() with: pInfo->m_bDirect = TRUE; to bypass the Print dialog, and I've set the print-to-file flag in OnBeginPrinting(): pInfo->m_pPD->m_pd.Flags |= PD_PRINTTOFILE; The last step is to stuff the path/filename string in the Print To File dialog... I can do this with an external app, but I'd like to do it inside the current a...

How to save my email password in MS Outlook 2002??
Hi, guys My laptop was repaired by a technician to clean the virus recently. When i got it back, I couldnt save my email logon password, even i click "Remember Password" as long as MS outlook is closed. Each time i open Outlook, I have to re-enter the password for the Logon Information.... Suggestion,..pls! Ken There have been several recent issues with passwords not being retained with Outlook. Office XP SP1 solves many of these for Outlook 2002, so start there. If not, here are some other solutions: For Outlook 2000 or 2002 on Win 98, NT, or 2000: http://support.microsoft....

Save as a picture
I have a group of cells that contain names and numbers. Column A has the name and column be has there score Is there anyway of being able to select those cells only and save them as a picture. I have tried to copy them and paste them into the Paint program and save as a picture but it doesnt copy the exact formatting over. Is there another alternative?? Thanks Andrew Andy Pope has a free add-in that you can use to export images: http://www.andypope.info/vba/gex.htm Andrew wrote: > I have a group of cells that contain names and numbers. > > Column A has the name and...

Saving Worksheet as another application
How can I save a worksheet as MS Word. The party I need to e-mail does not have Excel, and can not open the file. I need to save it in order to attach to an e-mail Tks Bill Select all cells. Hit Copy. Go to Word, paste. It should provide in a similar layout. **** Hope it helps! **** ~Dreamboat Excel VBA Certification Coming Soon! www.VBAExpress.com/training/ ******************************** "bill" <billjames@christytrucking.com> wrote in message news:03bc01c4a65e$b2e31660$a301280a@phx.gbl... > How can I save a worksheet as MS Word. The party I need to > e-mail does no...

Outlook Web Access "need to lock down save-as, delete,copy,move,pr
Need to lock down save-as, delete, copy, move and print on the Outlook Web Access toolbar. When they open the email attachment don 't allow them to save the attachments to there laptop or home computer. Would this be administrative template in group policies? Where would I find any Microsoft white paper on this subject? You can segment OWA functionality through registry settings. See KB: http://support.microsoft.com/kb/311154/EN-US/ "omontoya" wrote: > Need to lock down save-as, delete, copy, move and print on the Outlook Web > Access toolbar. When they open the e...

how do i save as a dbf file from access 2007
I have a need to be able to edit and save as a dbf file from access 2007. any ideas?? ...

"Save as" dialog hanging on certain network folder
I am trying to troubleshoot a very small business network. There is a folder shared from a Windows XP Pro machine, and when initiating a save as dialog to this location, many office applications will hang when it appears to be loading the contents of the folder. I have tested Excel and Word, versions 2000 and 2003. Navigating to the folder in explorer works just fine. I thought rebooting would help, but the issue appears to effect the machine even after a fresh boot. Some machines on our network behave correctly. Others will hang for a short while but eventually load the conte...

Print notes on purchase order blank report
How can I print the notes from purchase order header on the purchase order blank report? thank you in advance. You can modify the PO in Report Writer. Link the Records Notes Master to the Purchase Order HEader table and include the notes table in the report. Then the notes text field will be available to be displayed in the report. Regards Sivakumar V On Nov 17, 6:38 am, "Jack Tundra" <jacktun...@hotmail.com> wrote: > How can I print the notes from purchase order header on the purchase order > blank report? thank you in advance. Hi I am sorry but I cannot find th...

Office 2000 Excel SP-3: Nasty intermittent bug during save.
The bug occurs in the following circumstances (although not every time). 1. Two files are open, - a 'book4' type temporary file that I couldn't care less about. - a rather large 10 sheet workbook that I've been working on. 2. I try to save the large file - instead - the _temporary file_ is saved _over_ the large file on the disk. - an error message is displayed saying the file has been saved but that it is out of memory and had to close it. - the temporary file is displayed. 3. Generally the large file disappears from the task bar. 4. If the large file doesn't disppea...

Is it possible to save an excel chart as .emf?
I would like to save an excel chart as .emf instead of .jpeg or .gif using the script below. Is this possible? Sub SaveChartAsGIF () Fname = ThisWorkbook.Path & "\" & ActiveChart.Name & ".gif" ActiveChart.Export FileName:=Fname, FilterName:="GIF" End Sub ...

Grey text prints as black..
I'm printing a page that has some text de-emphasized by using a grey font colour. Unfortunately when I print it comes out as black like the rest of the text. I looked for a setting in the Options and in the Print dialogs, but was unable to see anything that said "allow grayscale" anywhere. Suggestions anyone? thanks... R. I have the same problem and have not yet found a solution. could it be a configuration problem with the printer? Have you recently re-installed Excell? Julien "RGK" a écrit : > I'm printing a page that has some text de-empha...

Make Table Query
I have a Macro and at the end of the Macro I have a Make Table Query that I would like to automatically save as todays date in the current database. Does anybody have an idea on how I can do this? On Wed, 06 Jun 2007 11:40:24 -0700, dswiders@gmail.com wrote: >I have a Macro and at the end of the Macro I have a Make Table Query >that I would like to automatically save as todays date in the current >database. Does anybody have an idea on how I can do this? A date is just a field value. Saving today's date as a Table is almost certainly VERY bad design. Why do an expensive, awk...

Save e-mail mesages in Outlook Message format as Default option
When i want to dave an e-mail message, the default 'Save As' option is HTML format. How do I change the default option to save as Microsoft Outlook Message format? As it is now, I have to manually change the option every time I want to save a message. Thanks. See your other post. -- Robert Sparnaaij [MVP-Outlook] Coauthor, Configuring Microsoft Outlook 2003 http://www.howto-outlook.com/ Outlook FAQ, HowTo, Downloads, Add-Ins and more http://www.msoutlook.info/ Real World Questions, Real World Answers ----- "JRSCEI" <JRSCEI@discussions.microsoft...

Easiest way to print AND display data on screen.
I've got a project that involves displaying and printing data. All the data is readonly in Access 2007. All I have to do is display the data using various charts and lists. I'm trying to decide whether to use Access or Excel to display the data. The thing I like about Excel is that I can display the data on the screen and it can also be printed. It seems to me that if I do it in Access I will have to do double the work. I'll have to display charts on a form to show it on the screen but create a report to print it. Is this correct? Is there a way to print a form in Access 20...

Additional file with no extension created during File Save As proc
Good morning all! I originally posted this query on the Developer board, as I thought it was a problem with my code, but now I'm not so sure. I have a workbook with a macro that runs a Save As within a loop, to create test data files. I was finding that for every new file I created, and additional file with a filename comprisiong eight alphanumeric characters and no file extenson was created in the same folder. Thinking that the workbook might be corrupted, I created a new workbook (with NO copying/pasting from the original - everything types in from scratch) , created new code m...

How can I save a file as a comma-delimited text file in Excel?
I am pulling in a comma, delimited text file to Excel, and then generating a new column of information. I want to save it back to a comma, delimited text file, but I don't see this option when I select to Save As... Is there a way to do this? I am currently running Excel 2002. Thanks, I also have Excel 2002 and there are three options under "Save As..." to save as "CSV", comma delimited text file (one option for 'Windows', DOS and Macintosh). Try scrolling further down the list. If these options are not available then perhaps these options depend on opt...

How can I retain leading zeroes when saving as a CSV file?
I use a MS Query to pull address data from an ERP package. This data includes a numeric “location code”. These location codes are 4 digits, and some have leading zeroes. I then take the resulting .xls spreadsheet, do some subtle formatting, and then save as a .csv for uploading to a web server. I need to retain the leading zeroes so that when data comes back to the ERP from the web, the location code is four digits. I’ve tried formatting the location code as text, in hopes that the conversion to .csv will retain the zero. No luck. Is there anything else I should try? Change file...

SAVE PASSWORDS!!!
Hi Outlook 2002 for Windows XP does not save passwords for POP3 accounts. After searching through the discussion forums, I have found and tried the following KB articles http://support.microsoft.com/default.aspx?scid=KB;EN-US;25941 http://support.microsoft.com/default.aspx?scid=kb;en-us;Q26467 http://support.microsoft.com/?id=29068 http://windows-help.net/WindowsXP/troub-01.htm THEY DONT FIX IT!! Windows update says that there are no service packs to be installed, so, I know I have all the latest ones installed There has to be a solution for this and Im sure there are many others facing t...

OL 2002: Won't save passwords
I converted from OL Express 6 to OL 2002. I only use it for POP3 email. Outlook will simply not retain passwords at all. Not on the old accounts, not after prompting, not creating new accounts, etc. This all happened at the same time I applied some Windows XP Pro updates as well. Now IE 6 won't save apsswords either. Don't know if they're related. I've searched the KB and reviewed dozens of potentially related articles, but to no avail. Any ideas? Thanks in advance, Heman ...

save a doument that has not been modified
I am asked to save a document that has not been modified. Even a new unedited new book1 file asks if I want to save? This often happens if there are any functions in the worksheet that would force a recalculation, such as =TODAY(). -- HTH Bob Phillips "Alan" <Alan@discussions.microsoft.com> wrote in message news:5D92BD31-A193-4BA5-B015-AFFC2C8B8643@microsoft.com... > I am asked to save a document that has not been modified. Even a new unedited > new book1 file asks if I want to save? Cheers bob, but I can open a new document with no entries and I still get aske...

OWA
Is there a way to disable or remove the "save password" on the log on screen for OWA? I am using E2K3 with AD2000 TIA Tom "Tom McCarroll" <TomMcCarroll@discussions.microsoft.com> wrote in message news:D5FF0A43-D0CE-433A-960D-095C69AF9290@microsoft.com... > Is there a way to disable or remove the "save password" on the log on screen > for OWA? > > I am using E2K3 with AD2000 > > > TIA > > Tom I think you are referring to the browser's own option to save the password, since this feature is not part of OWA per se. If you...