Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Exporting to PowerPoint

Hello all,
Thanks in advance for reading my post. I'm trying to add a feature
that'll allow users of my spreadsheet to select and export a sheet to
a PowerPoint slide.
A combo box shows all the available sheets and copy + pastes the
selected range ( active range) to a PowerPoint slide. The code works
fine in a " standalone" mode. Meaning, I tried the code in a workbook
that didn't have any other subroutines/macros or forms and it works
fine. But, when I add it to another workbook that has many other
macros and forms, I keep getting numerous errors. The errors that I
get are...

1st error:
--------------
An outgoing call cannot be made since teh application is dispatching
an input-synchronus call.

2nd error:
-------------
invalid procedure call or argument

3rd error. ( doesn't happen always)
Cannot access network


Here's the code for the form
---------------------------------

Private Sub UserForm_Initialize()

With frmSelectReport2Export2PPT
.Caption = "Select Report To Export To PowerPoint"
.ForeColor = &H8000000E
.BackColor = &H80000001
.Font.Bold = True
.StartUpPosition = 2 'center screen
.Height = 157.5
.Width = 355.5
End With


With cmbSelectReport
.ForeColor = &H8000000E
.BackColor = &H80000001
.Font.Bold = True
.Height = 24
.Width = 174
.Top = 18
.Left = 162
.RowSource = "VBA_Data!ReportList"
'the range reportlist contains a list of all worksheets
End With

With cmdCancel
.Caption = "Cancel"
.ForeColor = &H8000000E
.BackColor = &H80000001
.Font.Bold = True
.Height = 24
.Width = 84
.Top = 84
.Left = 252.05
End With



Private Sub cmdContinue_Click()
'Application.ScreenUpdating = False
Unload Me
strSheetName = cmbSelectReport.Value



Sheets(strSheetName).Select


'range b12 is present in almost every report
Range("B12").Select
Selection.CurrentRegion.Select

Export2PPT
Application.ScreenUpdating = True

End Sub



Here's the code for the macro.....
----------------------------------


Sub Export2PPT()
'saves selected sheet as an PowerPoint slide.
'the sheet needs to be selected first.

Selection.Copy
Dim oPpoint As PowerPoint.Application
On Error Resume Next
Set oPpoint = GetObject(, "PowerPoint.Application")
On Error Resume Next

If oPpoint Is Nothing Then
Set oPpoint = CreateObject("PowerPoint.Application")
oPpoint.Activate
oPpoint.Visible = msoTrue
End If
'oPpoint.Visible = msoTrue
On Error Resume Next

With oPpoint
If .Presentations.Count = 0 Then
.Presentations.Add WithWindow:=msoTrue
End If
.ActiveWindow.View.GotoSlide
Index:=.ActivePresentation.Slides.Add(Index:=.Acti vePresentation.Slides.Count
+ 1, Layout:=ppLayoutBlank).SlideIndex
.ActiveWindow.View.Paste
With .ActiveWindow.Selection.ShapeRange
.LockAspectRatio = msoFalse
.Width = oPpoint.ActivePresentation.PageSetup.SlideWidth
.Height = oPpoint.ActivePresentation.PageSetup.SlideHeight
.Top = 0
.Left = 0
End With
End With
Application.CutCopyMode = False


Application.ScreenUpdating = True

End Sub



Any idea what's causing this?


Thanks!
A. Rahman
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
exporting multiple graphs from excel to powerpoint JPhish Excel Discussion (Misc queries) 1 March 17th 09 04:39 PM
Exporting excel charts with form controls (spinner) to Powerpoint Mike B Charts and Charting in Excel 1 November 18th 07 04:10 PM
Exporting Excel Graph to PowerPoint or Flash REji Charts and Charting in Excel 0 September 3rd 07 12:54 PM
powerpoint to wmv Teacher Excel Discussion (Misc queries) 1 April 18th 07 12:37 AM
Powerpoint sonja Charts and Charting in Excel 1 March 1st 05 04:15 PM


All times are GMT +1. The time now is 04:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"