vba code to create a pdf file. RRS feed

  • General discussion

  • Hi all,,,,,,,,,

    Plzzzzzzz help me with the vba code to create a pdf file say(.pdf) files....

    I have a code which would create text/word/excel files .....But I tried this code to create a pdf file....But I couldn't make it.....Though the file is created but i am unable to view it..... me this out..........

    The following is the code ........

    Public Sub veeru()    

    Const FILENAME = "C:\Users\310314\Desktop\myfile.xls"  

     Dim My_filenumber As Integer    

    My_filenumber = FreeFile  

    Open FILENAME For Output As #My_filenumber    

    Write #My_filenumber, "Hello"    

    Close #My_filenumber End Sub


    Monday, May 7, 2012 5:44 PM

All replies

  • From which application do you want to create a PDF file? Word, Excel, PowerPoint, ...?

    And which version? 2003, 2007, 2010, ...?

    Regards, Hans Vogelaar

    Monday, May 7, 2012 8:13 PM
  • It is not necessary that I need to create a pdf file from an Application. I just want to create a pdf file with some text in it.......say for example...."hello word......"

    That is enough for me so that it would be helpful for me to create 'n' number of pdf files for the test data to my application....


    Tuesday, May 8, 2012 4:17 AM
  • A PDF file is more complicated than a text file.

    Create a document in Word.

    Enter the text Hello World or whatever you want.

    Save the document as a PDF file.

    Regards, Hans Vogelaar

    Tuesday, May 8, 2012 6:06 AM