Kath Pelletti
KP at sdsonline.net
Thu Jun 24 18:53:35 CDT 2004
Hi eveyone - I need to write some code to open a 'template' file in Frontpage (ie. create a new .asp file based on a frontpage template which I will create) I dont have much experience opening other apps, but I use this code in another app to open a s/sheet in Excel (see below). Can you tell me - is this the fastest way to open a Frontpage file too? Is it CreateObject ("Frontpage.application")? TIA Kath -------------------------------------------------------------------------------- Private Function CreateSpreadsheet(rsRecordset As ADODB.Recordset) As Long Dim strerrormsg As String Dim ExcelRunning As Boolean Dim xlApp As Object Dim cell() Dim lRows As Long Dim lColumns As Long Dim lColPtr As Long Dim lRowPtr As Long Dim strRange As String On Error GoTo Err_Handler 'Create spreadsheet ExcelRunning = IsExcelRunning() If Not ExcelRunning Then Set xlApp = CreateObject("Excel.Application") Else Set xlApp = GetObject(, "Excel.Application") End If 'Set xlapp = CreateObject("excel.application") xlApp.Workbooks.Add 'etc etc -------------------------------------------------------------------------------- Function IsExcelRunning() As Boolean Dim strerrormsg As String On Error GoTo Err_Handler Dim xlApp As Excel.Application On Error Resume Next Set xlApp = GetObject(, "Excel.Application") IsExcelRunning = (Err.Number = 0) Set xlApp = Nothing Err.Clear Normal_exit: DoCmd.SetWarnings True Exit Function Err_Handler: MsgBox "Error: [" & Err.Number & "] " & IIf(Len(strerrormsg) > 0, strerrormsg, Err.Description), vbCritical, "Error Message" hcursor = CursorID RetVal = SetCursor(hcursor) Resume Normal_exit End Function -------------------------------------------------------------------------------- Kath Pelletti Software Design & Solutions Pty Ltd. Ph: 9505-6714 Fax: 9505-6430 KP at SDSOnline.net