E
Eric B
What I want to do is have a button in my ppt presentation that when clicked:
1. opens an existing excel file
2. copies information from text boxes in ppt to excel
3. prints the excel page
4. saves the excel page
5. closes excel
I am currently having problems getting the excel file to open. When I
created a new/blank file I was able to write information to cells and
save the spreadsheet. I have not tried printing the excel file yet. I
have searched the ppt help files but haven't been able to come up with a
way to open an existing file. When I had the file open before the macro
was initiated, the code seemed to work fine. When I would close out of
Excel and then run the macro, it didn't.
Thanks in advance.
This is the direction I am currently heading:
Dim ExcelSheet As Object
' Set ExcelSheet = GetObject(ActivePresentation.Path + "\delme.xls",
"Excel.Application")
Set ExcelSheet = GetObject(ActivePresentation.Path + "\delme.xls")
ExcelSheet.Application.Visible = True
(The sheet won't have to be visible to the user. But I might keep this
code in so they can name give the file a name of their choice.)
ExcelSheet.Application.workbooks(ActivePresentation.Path +
"\delme.xls").Activate
ExcelSheet.Application.Worksheets("Sheet1").Activate
ExcelSheet.Application.Cells(2, 11).Value = "This is column K, row 2"
' Save the sheet to C:\test.xls directory.
ExcelSheet.SaveAs ActivePresentation.Path + "\TEST.XLS"
' Close Excel with the Quit method on the Application object.
ExcelSheet.Application.Quit
' Release the object variable.
Set ExcelSheet = Nothing
End Sub
1. opens an existing excel file
2. copies information from text boxes in ppt to excel
3. prints the excel page
4. saves the excel page
5. closes excel
I am currently having problems getting the excel file to open. When I
created a new/blank file I was able to write information to cells and
save the spreadsheet. I have not tried printing the excel file yet. I
have searched the ppt help files but haven't been able to come up with a
way to open an existing file. When I had the file open before the macro
was initiated, the code seemed to work fine. When I would close out of
Excel and then run the macro, it didn't.
Thanks in advance.
This is the direction I am currently heading:
Dim ExcelSheet As Object
' Set ExcelSheet = GetObject(ActivePresentation.Path + "\delme.xls",
"Excel.Application")
Set ExcelSheet = GetObject(ActivePresentation.Path + "\delme.xls")
ExcelSheet.Application.Visible = True
(The sheet won't have to be visible to the user. But I might keep this
code in so they can name give the file a name of their choice.)
ExcelSheet.Application.workbooks(ActivePresentation.Path +
"\delme.xls").Activate
ExcelSheet.Application.Worksheets("Sheet1").Activate
ExcelSheet.Application.Cells(2, 11).Value = "This is column K, row 2"
' Save the sheet to C:\test.xls directory.
ExcelSheet.SaveAs ActivePresentation.Path + "\TEST.XLS"
' Close Excel with the Quit method on the Application object.
ExcelSheet.Application.Quit
' Release the object variable.
Set ExcelSheet = Nothing
End Sub