Consulting

Results 1 to 6 of 6

Thread: Solved: getting text from excel cells

  1. #1

    Solved: getting text from excel cells

    I am using a jeopardy game in Powerpoint. I want to enter the questions & answers in excel cells and run a macro to put the cells contents into text boxes in powerpoint slides. Possible?

  2. #2
    Knowledge Base Approver VBAX Master Oorang's Avatar
    Joined
    Jan 2007
    Posts
    1,135
    Location
    Totally But why excel/powerpoint combination (why not just use one or the other)?
    Cordially,
    Aaron



    Keep Our Board Clean!
    • Please Mark your thread "Solved" if you get an acceptable response (under thread tools).
    • Enclose your code in VBA tags then it will be formatted as per the VBIDE to improve readability.

  3. #3
    I see it faster entering all questions and answers for the game in on place. So far, I have suggestions to turn the excel into a csv file w/ comma delimitation and using the SPLIT command to get an array. I've done that here:
    Sub ReadAsciiFile()
    
        Dim sFileName As String
        Dim iFileNum As Integer
        Dim sBuf As String
        Dim strB() As String
        ' edit this:
        sFileName = "C:\Users\srainbol\Desktop\test.txt"
    
        ' does the file exist?  simpleminded test:
        If Len(Dir$(sFileName)) = 0 Then
            Exit Sub
        End If
    
        iFileNum = FreeFile()
        Open sFileName For Input As iFileNum
    
        Do While Not EOF(iFileNum)
            Line Input #iFileNum, sBuf
            strB() = Split(sBuf, ",")
            ' now you have the next line of the file in sBuf
            ' do something useful:
            Debug.Print sBuf
        Loop
    
        ' close the file
        Close iFileNum
    
    End Sub
    Now, I need to get this into slides in the Jeopardy Game PPP

  4. #4
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    Quote Originally Posted by srainbol
    I see it faster entering all questions and answers for the game in on place. So far, I have suggestions to turn the excel into a csv file w/ comma delimitation and using the SPLIT command to get an array. I've done that here:
    Sub ReadAsciiFile()
     
        Dim sFileName As String
        Dim iFileNum As Integer
        Dim sBuf As String
        Dim strB() As String
        ' edit this:
        sFileName = "C:\Users\srainbol\Desktop\test.txt"
     
        ' does the file exist?  simpleminded test:
        If Len(Dir$(sFileName)) = 0 Then
            Exit Sub
        End If
     
        iFileNum = FreeFile()
        Open sFileName For Input As iFileNum
     
        Do While Not EOF(iFileNum)
            Line Input #iFileNum, sBuf
            strB() = Split(sBuf, ",")
     
    '******NOTE should be strB=Split(sBuf,",")*********
     
            ' now you have the next line of the file in sBuf
            ' do something useful:
            Debug.Print sBuf
        Loop
     
        ' close the file
        Close iFileNum
     
    End Sub
    Now, I need to get this into slides in the Jeopardy Game PPP
    If eg your first line in the text file was the question,the answer,the score

    Then
    strB(0) would be "the question"
    strB(1) = "the answer"
    strB(2) ="the score"

    use these values to populate the textboxes in your game slide 1 and then go on to line two for slide 2
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  5. #5
    Knowledge Base Approver VBAX Master Oorang's Avatar
    Joined
    Jan 2007
    Posts
    1,135
    Location
    What I was driving at was why use power point as your front end, why not do the whole thing in Excel? To build it in powerpoint you are going to have to build a harness just to hook into the events before you can even start to code the test.
    Cordially,
    Aaron



    Keep Our Board Clean!
    • Please Mark your thread "Solved" if you get an acceptable response (under thread tools).
    • Enclose your code in VBA tags then it will be formatted as per the VBIDE to improve readability.

  6. #6
    for John
    I do not know how to
    "use these values to populate the textboxes in your game slide 1 and then go on to line two for slide 2."

    Please give me an idea to work on.

Posting Permissions

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