none
Using Input from TextBox in code RRS feed

  • Question

  • I am trying to understand how to save my powerpoint presentation as a PDF file using the user's input in TextBox1 as the file name that is created.  If I eliminate Dim strFilename As String, strFilename = TextBox1.Text, and & strFilename the PowerPoint does save as a PDF.  I am using this to create employee training products and I want to save their PowerPoint as their name which is what they are directed to do in TextBox1.  Thank you for anytime dedicated to assisting me with my current issue.  I hope I described the problem in enough detail.

    The code that I used:

    Private Sub CommandButton2_Click()
    Dim strFilename As String
    strFilename = TextBox1.Text
    ActivePresentation.ExportAsFixedFormat "G:\plantser\Training Tools\Completed Training\Chicken\Process Verification\" & strFilename ".PDF", ppFixedFormatTypePDF, False, False
    End Sub

    Tuesday, October 10, 2017 10:45 AM

All replies

  • Hello,

    Do you get any error when exporting? Please hard code file path or the variable strFilename to check if it could be exported.

    Regards,

    Celeste 


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, October 11, 2017 2:17 AM
    Moderator
  • Hi Endure,

    Has your issue been resolved? Based on your code, I found you miss “&” between strFileName and “.pdf” which will cause error.

    I suggest you try below code.

    ActivePresentation.ExportAsFixedFormat "G:\plantser\Training Tools\Completed Training\Chicken\Process Verification\" & strFilename & ".PDF", ppFixedFormatTypePDF, False, False

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, October 20, 2017 8:42 AM