|
-
Mar 14th, 2010, 04:39 AM
#1
Thread Starter
New Member
[RESOLVED] Write to Excel from PPT (Test)
Hi all,
While working with VBA in PowerPoint, I stumbled upon a problem.
The variables I entered on the first slide aren't accessible on the other slides. Is there a way to remember it on all slides.
By clicking a button in PowerPoint, a cell in an Excelfile needs to be updated. Each slide writes a value to a different cell, every button on that slide writes a different value to the same cell.
To solve this, I found this way.
If the button is pressed:
1. The Excel-file is opened (hidden)
2. The value is exported
3. The Excel-file is closed (and saved)
The problem that remains is that I can only link to one file, while I want to select one of 22 in te first slide.
The only solution I can think of is to make 22 different presentations, with each a different linked Excel-file.
Is (t)here someone who can help me with this?
Or is there a code to "replace all" in the code while running the presentation, so I can change al links in the presentation by clicking a button at the start?
Code:
Public oXLApp As Excel.Application
Public oWB As Workbook
Private Sub CommandButton1_Click()
Set oXLApp = New Excel.Application
Set oWB = oXLApp.Workbooks.Open(ActivePresentation.Path & "\UGT.xls")
If Not oWB Is Nothing Then
oWB.Worksheets(3).Range("B3") = "a"
oXLApp.Visible = False
End If
oWB.Close True
oXLApp.Quit
ActivePresentation.SlideShowWindow.View.Next
Exit Sub
End Sub
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|