Consulting

Results 1 to 7 of 7

Thread: Address PowerPoint when its name constantly changes

  1. #1

    Address PowerPoint when its name constantly changes

    Hello,

    I want to copy a Diagram from Excel to a specific Powerpoint. Currently I am addressing this Powerpoint with its Name (MyPowerpoint.pptx). I searched for a way to find this PowerPoint (it will be in the same folder as the excel) but without mentioning its name.

    I searched the internet and read things about CustomDocumentProperties or Tags but could not figure it out.

    How can I copy something from excel to powerpoint, without mentioning the Name of the Powerpoint?

    Kind regards

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    You probably need to explain WHY the name is constantly changing. Will it be the only pptx in the same folder as the excel file?
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    It might not constantly change, but the user could write v1 oder v2 at the end of the file.

    Yes it is planned, that is the only Powerpoint in this folder. Have to write it into the excel and highlight it because otherwise people will put files in there..

  4. #4
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    This is,a general "Open the only pptx in a folder" routine that should give you a start.

    Sub noName_open()
    ' change this folder path obviously!
    Const sFolderPath As String = "c:\users\info\Desktop\test\"
    Const sFilespec As String = "*.pptx"
    Dim strPresPath As String
    Dim opres As Presentation
    strPresPath = Dir$(sFolderPath & sFilespec)
    Set opres = Presentations.Open(sFolderPath & strPresPath)
    End Sub
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  5. #5
    Thanks will try it out right now!

  6. #6
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,711
    Location
    I thought you were looking for an Excel macro that would open the PP file

    Option Explicit
    
    
    Sub OpenTheOnlyOne()
        Dim sPPTX As String
        Dim oPres As Object, oPP As Object
    
    
        sPPTX = Dir(ThisWorkbook.Path & Application.PathSeparator & "*.pptx")
        sPPTX = ThisWorkbook.Path & Application.PathSeparator & sPPTX
        
        Set oPP = CreateObject("Powerpoint.Application")
        Set oPres = oPP.presentations.Open(sPPTX)
    End Sub
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  7. #7

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •