Creating pdf from selected cell range [Solved/Closed]

cvsuryam 2 Posts Monday May 20, 2013Registration date July 25, 2013 Last seen - May 20, 2013 at 04:00 AM - Latest reply: sgmpatnaik 54 Posts Tuesday April 2, 2013Registration date November 27, 2013 Last seen
- Jul 4, 2013 at 07:36 AM
Dear all,
greetings.

firstly , I would like to thank those who have helped me to get below code (to create pdf file for selected cell range) which worked nicely in excel 2007 (windows xp).
I have been using this code since two years.
I'm pasting the code below.
This code is working nicely in XP.
Recently I have upgraded my system to Windwos -7. Now this code is not working . I am getting runtime error "5" (invalid procedure call or argument)

I request you all to help to modify the code to work in excel 2007 but operating system is windows 7

thanks in advance for all your effort and help
thanks
suryam

---------------find code----------------------------------------------


Sub CREATEPDF_Click()
Dim SourceWS As Worksheet, DestWS As Worksheet
Dim Inv As Long
Dim Fname As String
Set SourceWS = Sheets("INVOICE")
If SourceWS.Range("J40") = 0 Then
MsgBox "NO NEW PDF TO PREPARE !!", vbExclamation + vbInformation, "NO NEW INVOICE TO PREPARE"
Exit Sub
Else
Sheets("INVOICE").Select
Inv = Mid(Range("I19"), 13, 5)
Fname = "C:\Documents and Settings\User\My Documents\INVOICE " & Inv & ".pdf"
Range("B6:J54").Select
Selection.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Fname, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
End If
End Sub
---------------end of code-------------------------------------------
See more 

1 reply

sgmpatnaik 54 Posts Tuesday April 2, 2013Registration date November 27, 2013 Last seen - Jul 4, 2013 at 07:36 AM
0
Thank you
Hi

I think in your upgrade version you have missed one Add - in so please download the Add - In and install then after check did your code works or not

http://www.microsoft.com/en-in/download/details.aspx?id=7


Hope it will solve your problem other wise please inform us

Thanks

SP