cancel
Showing results for 
Search instead for 
Did you mean: 

Open Excel

Former Member
0 Kudos

Hi friends,

I need to open an excel file from a sap business one form.

Accepted Solutions (1)

Accepted Solutions (1)

Nussi
Active Contributor
0 Kudos

Hi

simple create a button that imports a file with the following code.

[Import Excel Sample|;

lg David

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

Or, VB code to attach to button, how read data from Excel Workbook, you can find in this thread [Import Data to UDO|;.

To simple open file:


Public Sub ManageItemEvent( _
      ByVal FormUID As String, _
      ByRef pVal As SAPbouiCOM.ItemEvent, _
      ByRef BubbleEvent As Boolean _
) 'Handles SBO_Application.ItemEvent

  Dim oForm As SAPbouiCOM.Form
  oForm = SBO_Application.Forms.Item(FormUID)

  Select Case pVal.EventType
    
    Case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED
      If pVal.ItemUID.Equals("btnExcel") And Not pVal.BeforeAction Then
        Call OpenExcelFile("C:TEMPmy_excel_file.xls")
        BubbleEvent = False
      Else
        BubbleEvent = True
      End If
  End Select
End Sub


Private Sub OpenExcelFile(ByVal sXlsFile As String)
  'Dim iRetVal As Integer
  Try
    Dim startInfo As New ProcessStartInfo(sXlsFile)
    startInfo.WindowStyle = ProcessWindowStyle.Maximized
    Process.Start(startInfo)
  Catch ex As Exception
    ' log exception
  Finally
    System.GC.Collect() 'Release the handle to the table 
  End Try
End Sub

HTH

Sierdna S.

Edited by: Sierdna S on Sep 29, 2008 9:43 AM