Error text = Error calling external object function run at line 78 in
function of_createdocument of object n_cst_cobraolereportviewer..
Window/Menu/Object = n_cst_cobraolereportviewer.
Error Object/Control = n_cst_cobraolereportviewer.
Script = of_createdocument.
Line in Script = 78.
---------------------------
OK
---------------------------
Code causing this error :
//Prepare Word Document
lole_Report.Selection.TypeText(ls_ReportTitle)
lole_Report.Application.Run("Prepare_LEC_Report")
Please help
My apologies for posting the same issue in all groups.
lole_Report.Application.Run("Prepare_LEC_Report")
Above line is causing the issue.
n_cst_cobraolereportviewer --> of_createdocument
************************************************************
SetPointer(HourGlass!)
/*************************************************************/
// Project: COBRA
// Event: wf_CreateDocument(long al_rownumber)
// Author: Felipe DeGuzman
// Purpose: to retrieve the report, create an MS Word document, and
// post it to the OLE Control.
// Args: an_selectedrow
// Returns ()
// Rev Date Who Notes
// COBRA4.0 12/12/97 FD New Code
// COBRA5.0 6/24/99 KL Commented progress meter scripts
//
/*************************************************************/
//Variable Declarations
String ls_TestFileName, /*Returns a string For the Word Document title
used to validate that a good connection is made to MS Word*/ &
ls_ReportTitle,ls_Return
Boolean lb_SaveAsOptions
Long ll_PercentComplete, &
ll_Rtn,ll_Return,&
ll_ReportLineCount,&
ll_Result,&
ll_ReturnFileRecordCount,&
ll_ApproxProcessTime,ll_ApproxProcessTimeMin,ll_ApproxProcessTimeSec,
&
ll_LineLow,&
ll_LineHigh,&
ll_Count
n_cst_string inv_String
n_ds lds_FileLine
Oleobject lole_Report
SetPointer(HourGlass!)
//Delete temporary files
If FileExists(is_ReportRawTextFile) then FileDelete
(is_ReportRawTextFile)
If FileExists(as_mswordtempfile) then FileDelete(as_mswordtempfile)
//Get the title of the report
ls_ReportTitle=String(al_fileid)
//Create a datastore object to retrieve data
lds_FileLine=Create n_ds
lds_FileLine.dataobject='do_returnreportfile_linebatch'
lds_FileLine.of_SetTransObject(SQLCA)
gnv_app.of_GetFrame().SetMicroHelp("Retrieving Data for Report
Display. Please wait...")
//Retrieve lines from database
ll_ReportLineCount= lds_FileLine.Retrieve(al_FileID )
//Save Datastore contents (which should be one column of report file
lines to raw text file
ll_Rtn=lds_FileLine.SaveAs( is_ReportRawTextFile, Text!, False)
////////////////////////////////////////////////
// connect to MSWord //
///////////////////////////////////////////////
ll_Result = of_ConnectToWord(lole_Report)
If ll_Result <> 0 then
destroy lole_Report
messagebox("title", "Unable to create report due to problem
connecting to Microsoft Word "+string(ll_Result), &
exclamation!, ok!)
Return ll_Result
End IF
//MS Word Command
//Activate ole_report, but keep hidden from users
//Create new word document based on COBRA Report template
lole_Report.documents.add(is_MSWordTemplateFile,False)
ls_TestFileName = lole_Report.ActiveDocument.FullName
lole_Report.Selection.GoTo(True,0,0,"report_file_contents")
gnv_app.of_GetFrame().SetMicroHelp("Preparing Report for Display.
Please wait...")
//Prepare Word Document
lole_Report.Selection.TypeText(ls_ReportTitle)
lole_Report.Application.Run("Prepare_LEC_Report")
//MS Word Command
// Import the raw data into the MS Word document at bookmark location
lole_Report.Selection.InsertFile(is_ReportRawTextFile)
// MS Word Command
// Apply text formatting for readability and replace text.
// The character string "~f" is stored in the database
// whenever a pagebreak character is encountered. The next
// command replaces the "~f" with the MS Word manual page break.
lole_Report.Application.Run("Format_LEC_Report")
//MS Word Command
//Save Temporary file that will be loaded into the OLE control
//1. First determine if user has setting to Prompt for Properties
//2. Turn off Prompt for Properties
//3. Save File as Word Document
//4. Return Original Prompt for Properties Setting
lb_SaveAsOptions =
lole_Report.Application.Options.SavePropertiesPrompt
lole_Report.Application.Options.SavePropertiesPrompt=False
lole_Report.ActiveDocument.SaveAs(as_MSWordTempFile,1)
lole_Report.Application.Options.SavePropertiesPrompt=lb_SaveAsOptions
//MS Word Command
//Make MS Word Visible
//lole_Report.Visible=True
//lole_Report.Application.Activate()
// Disconnect from Word 8 to destroy object
lole_Report.DisconnectObject()
Destroy(lole_Report)
//Delete temporary file
if FileExists(is_ReportRawTextFile) then FileDelete
(is_ReportRawTextFile)
//Return number of lines in file
return ll_ReportLineCount
************************************************************
Please let me know if you need any other info
> On Jun 22, 6:35�pm, "Scott Morris"
<bo...@bogus.com>
> > wrote: Posting the same message to multiple newsgroups
> > independently and on multiple days is not likely to
> > encourage others to help. �In fact, it just may
> discourage them. �The fact that no one has
responded often
> > indicates that no one understands the issue or question.
> > �Perhaps now would be a good time to provide a
more
> > complete discussion of your situation - and not just the
> error message. �Usually it helps to include the
version
> > and build of PB as well as information about what
> > "thing" you are attempting to work with (or communicate
> > with). �Since this appears to be an OLE issue,
it would
> be most appropriate to post in the ole-ocx-activex NG.
�In
> > addition, you appear to be using a custom built user
> > object which has a pfc-sounding (and confusing) class
> name. �We don't have your code, so you will need
to
> > provide a bit more information than a function name and
> 2 lines of code.
>
> My apologies for posting the same issue in all groups.
>
> lole_Report.Application.Run("Prepare_LEC_Report")
>
> Above line is causing the issue.
>
>
> n_cst_cobraolereportviewer --> of_createdocument
> **********************************************************
> **
>
> SetPointer(HourGlass!)
> /*********************************************************
> ****/ // Project: COBRA
> // Event: wf_CreateDocument(long al_rownumber)
> // Author: Felipe DeGuzman
> // Purpose: to retrieve the report, create an MS
> Word document, and // post it to the
> OLE Control. // Args: an_selectedrow
> // Returns ()
> // Rev Date Who Notes
> // COBRA4.0 12/12/97 FD New Code
> // COBRA5.0 6/24/99 KL Commented
> progress meter scripts //
> /*********************************************************
> ****/ //Variable Declarations
> String ls_TestFileName, /*Returns a string For the Word
> Document title used to validate that a good connection is
> made to MS Word*/ &
> ls_ReportTitle,ls_Return
> Boolean lb_SaveAsOptions
> Long ll_PercentComplete, &
> ll_Rtn,ll_Return,&
> ll_ReportLineCount,&
> ll_Result,&
> ll_ReturnFileRecordCount,&
>
> ll_ApproxProcessTime,ll_ApproxProcessTimeMin
> ,ll_ApproxProcessTimeSec, &
> lole_Report.Application.Options.SavePropertiesPrompt
>
lole_Report.Application.Options.SavePropertiesPrompt=False
> lole_Report.ActiveDocument.SaveAs(as_MSWordTempFile,1)
>
lole_Report.Application.Options.SavePropertiesPrompt=lb_Sa