Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Selecting multiple sheets to print to PDF

Eric, I not test it but what is going wrong ?

See my page also
http://www.rondebruin.nl/pdf.htm




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm



"Eric_G" wrote in message ...

Can you see something inherently wrong with this code which is being
executed from 1 excel file on another:

Workbooks.Open Filename:="c:\File_2.xlsx", UpdateLinks:=3
xlfile_drive = "c\"
temp_file_name = "Savename.xlsx"

Workbooks("File_2.xlsx").Activate
Sheets(Array("Investment Models E", "Open Models E")).Select
Sheets("Investment Models E").Activate
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
xlfile_drive & temp_file_name _
, Quality:=xlQualityStandard, IncludeDocProperties:=True,
IgnorePrintAreas _
:=False, OpenAfterPublish:=False

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Selecting multiple sheets to print to PDF

Dave has provided some excellent code which I am using, BUT the problem is as
follows.

The "ActiveSheet" command seems to activate the worksheet in which the macro
is stored (and NOT the worksheets which I wish to print in
DestinationFileName). Even though the worksheets in the 2nd file have been
activated, they are not actually the ones being saved to PDF.

"Ron de Bruin" wrote:

Eric, I not test it but what is going wrong ?

See my page also
http://www.rondebruin.nl/pdf.htm




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm



"Eric_G" wrote in message ...

Can you see something inherently wrong with this code which is being
executed from 1 excel file on another:

Workbooks.Open Filename:="c:\File_2.xlsx", UpdateLinks:=3
xlfile_drive = "c\"
temp_file_name = "Savename.xlsx"

Workbooks("File_2.xlsx").Activate
Sheets(Array("Investment Models E", "Open Models E")).Select
Sheets("Investment Models E").Activate
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
xlfile_drive & temp_file_name _
, Quality:=xlQualityStandard, IncludeDocProperties:=True,
IgnorePrintAreas _
:=False, OpenAfterPublish:=False

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Selecting multiple sheets to print to PDF

I can't reproduce your problem with my tester

Public Sub print_files()
Dim wkbk As Workbook
Dim Destinationfile As String

Destinationfile = "C:\Users\Ron Desktop\Desktop\pdfpdf.xlsm"
Set wkbk = Workbooks.Open(Filename:=Destinationfile, UpdateLinks:=3)

With wkbk
.Activate 'it should already be active
.Sheets(Array("Investment Models E", "Open Models E")).Select
End With

ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:="C:\Users\Ron Desktop\Desktop\test.pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True

wkbk.Close False
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm



"Eric_G" wrote in message ...
Dave has provided some excellent code which I am using, BUT the problem is as
follows.

The "ActiveSheet" command seems to activate the worksheet in which the macro
is stored (and NOT the worksheets which I wish to print in
DestinationFileName). Even though the worksheets in the 2nd file have been
activated, they are not actually the ones being saved to PDF.

"Ron de Bruin" wrote:

Eric, I not test it but what is going wrong ?

See my page also
http://www.rondebruin.nl/pdf.htm




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm



"Eric_G" wrote in message ...

Can you see something inherently wrong with this code which is being
executed from 1 excel file on another:

Workbooks.Open Filename:="c:\File_2.xlsx", UpdateLinks:=3
xlfile_drive = "c\"
temp_file_name = "Savename.xlsx"

Workbooks("File_2.xlsx").Activate
Sheets(Array("Investment Models E", "Open Models E")).Select
Sheets("Investment Models E").Activate
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
xlfile_drive & temp_file_name _
, Quality:=xlQualityStandard, IncludeDocProperties:=True,
IgnorePrintAreas _
:=False, OpenAfterPublish:=False

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting multiple sheets jday Excel Programming 3 February 13th 09 04:58 PM
Selecting Multiple Sheets in VBA Gizmo63 Excel Worksheet Functions 4 May 8th 06 01:50 PM
selecting multiple sheets Dennis Excel Programming 2 January 1st 04 08:06 PM
selecting multiple sheets Young-Hwan Choi Excel Programming 2 November 24th 03 01:19 AM
Changing the value in multiple sheets without selecting those sheets herm Excel Programming 3 October 14th 03 03:50 PM


All times are GMT +1. The time now is 11:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"