• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Make a part of a worksheet to pdf ?

hoomantt

Member
Hi Dear Professors,

I Have a workbook with several sheets that calculates Personal Salary and I should give a worksheet(sheet1)to Accounting Unit In My Office.

How Can Make A button in a sheet that when i press it , a convertor module , makes my need.
 
Hi


Isn't this as simple as Print Selection and select PDF as the printer?


Is the selection you want to print a named range?


Use the macro recorder function to capture the steps and view the code.


Cheers

Glen
 
Good day hoomantt


Not sure which Excel version you are using but in2013 …….file/export/create pdf

In 2010 it is file/save as/ create pdf


This will create a pdf file of your worksheet selection to your chosen directory you can then keep the original and send a copy, that's it just a few mouse clicks
 
thanks dear imgonna $ bobhc ,

but i want a module for it .

i want to make pdf from a range in a sheet(e.g : sheet1/range(a2:h15))

Thanks
 
@hoomantt


Hi


if you would like to export to PDF from Excel sheet then try this below code

[pre]
Code:
Private Sub CommandButton1_Click()

pdfName = ActiveSheet.Range("A1")
ChDir "C:Temp" 'This is where you set a defult file path.
fileSaveName = Application.GetSaveAsFilename(pdfName, _
fileFilter:="PDF Files (*.pdf), *.pdf")
If fileSaveName <> False Then
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
fileSaveName _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
End If
MsgBox "File Saved to" & " " & fileSaveName
End Sub
[/pre]

Hope It will solve your problem, other wise inform us


Thanks


SP
 
hi and thanks sgmpatnaik

my english isnt very good.

i am working in a office and want to use this here.

we have not here Case system and use WYSE.

your work is very good but problem is the path of save file that works in every user . such as save in desktop of us .

i am thankfull of you if you help me...

very very very thank you
 
@hoomantt


Hi


with my above code the excel sheet is export to PDF using the name with the Range of A1


say your data stands from A1:H1000 then what is the name is stand in A1 and your export file name is equal to A1. If you would like to change Range then You can


2. Always it prompt for where to save if you want save direct in desktop then you can change the path


from "C:Temp" to


"C:usersSPDesktop"


as per your Desktop Path


Hope it will clear


Thanks


SP
 
hello dear sgmpatnaik

i test that but that is not work in my system . i changed from "C:Temp" to


"C:usersSPDesktop" but when play it , excel show bellow error :

run-time error '76':

path not found


what should i do?

thanks a lot my dear friend . . .
 
@hoomantt


HI


because i gave my system path can you please change the path as per your system


if you don't know how to know the system path then please create one excel file and save it into desktop then close the file and select the created file from desktop then right click on that file then go to properties and see the location in General there you can find the location of the file and Path


Thanks


SP
 
hi dear

i know that.(how to find a file path) but in my office , when another person open this file and use this program , will see the error message.

my question is : How can i write the address for everyone desktop (in system 64 bit) to save this file on it....

thanks
 
Good day hoomantt


Why do you not just convert the worksheet selection to a PDF in save and then Email all those on you list a copy
 
hi bobhc

beacuse i have 5 tables with different ranges in it.

and i want to make pdf just one of them (such as range(A2:F7)
 
hoomantt


Then just select that range, in print make sure print selection is chosen and then save as PDF
 
@hoomantt


Hi


Can you clarify some doubts of me


1. did you get the save box with My First Code when you press the command button


2. Did you Share the File or create a file for your each system


3. Do you have Temp Folder in your C Drive


about your range requirement'


Just Select the Range A2:F7 and give the Print Area, now C the code export to PDF only the given range of Print Area


Thanks


SP
 
dear sgmpatnaik

hi

1-yes

2-yes

3-yes

my range have not any problem . your file works perfectly.but just i want is : after change to pdf , the pdf file save on desktop of every user , not in temp folder.

thanks...
 
Hi ,


Can you go through this link , and implement the code posted there ?


http://www.ozgrid.com/forum/showthread.php?t=24985


Narayan
 
Back
Top