Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

OLE Automation Error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    OLE Automation Error

    Hi All,

    I have the OLE Automation Error message from this scripts. The one form was printed good without this error. However when I changed to another form, the A5 kept generated this Error.

    Does anyone know how to address my issue?

    Code:
    'Print here
    query.filter= filter
    query.order ="FirstName"
    Dim vSaveFolder as c = "\\cpu7\Teamwork\data\page1.pdf"
          :report.SaveAs(vRptNm,"pdf",query.filter,query.order,vSaveFolder,.f.)	
    
          var->vMrgFile = "\\cpu7\Teamwork\data\pageCombine.pdf"
    
          pdf_merge(vSaveFolder,vPage2,var->vMrgFile,.t.,.f.)
    Attached Files

    #2
    Re: OLE Automation Error

    You have variables in your script whose assignments are not shown.

    vPage2 and vRptNm

    It is impossible to diagnose your issue when you provide incomplete information. The error says a pdf cannot be opened. It would seem to be the one named in the variable vPage2, but who knows?
    There can be only one.

    Comment


      #3
      Re: OLE Automation Error

      Stan,

      This is the full code.

      Code:
      	'Create an XDialog dialog box to prompt for parameters.
      	dim dlg_title as c ="What do you want to Print? "
      	DIM vRptType as C
      	DIM vBadgeNm as C
      	Dim vBadgeId as c
      	
      	DIM vBadgeId_rl_def as C 
      	vBadgeId_rl_def = "k=badge,{keylist_build(\"H=.05,1:25[Form_Name],2:25[Authorizer]\",''+Badge_id,left(''+Form_name,25),left(''+Authorizer,25))}{}"
      
      	DIM vLists as C
      	DIM varC_rpt as C
      	tables_sets_vLists = <<%filenames%
      	emp.dbf
      	%filenames%
      
      	'Get just the objects for the specified table/set names
      	auto_list_vLists = a5enum("Report",alltrim(tables_sets_vLists))
      	temp_count = w_count(auto_list_vLists,crlf())
      	DELETE a_vLists
      	DIM a_vLists[temp_count] as c
      	a_vLists.initialize(auto_list_vLists)
      	
      	vRptType="Standard Reports"
      	
      	DIM varC_Rpt as C
      	ok_button_label = "&Print"
      	cancel_button_label = "&Cancel"
      	varC_Rpt = ui_dlg_box(dlg_title,<<%dlg%
      	{region}
      	{region}{sp=2}Report Type: {endregion}|
      	{region} (vRptType:Standard Reports);
      	(vRptType:Customer Forms);{endregion};
      	{lf};
      	{condition=(vRptType="Customer Forms")}
      	{region=b}{sp=2}Customer Forms:| [%@vBadgeId_rl_def%.40vBadgeId]{endregion}
      	{condition=(vRptType="Standard Reports")}{start_pos}
      	{region=b}{sp=2}Standard Report:| [.40vLists^+a_vLists]{endregion}
      	{endregion};
      	{condition=.t.}
      	
      	{line=1,0};
      	{region}{justify=right}
      	<*15=ok_button_label!&Print> <15=cancel_button_label!CANCEL>
      	{endregion};
      	%dlg%)
      if varC_rpt = "&Print" then
      		if vRptType = "Customer Forms" then
      			'Make the Form selection here then print pdf & merge
      			'Open the table that you want to Find the Form name & A5 Report name
      			dim tBadge as p
      			dim qBadge as p
      			dim rBadge as n
      			dim vRptNm as c
      			dim vPage2 as c
      			dim tbl as p 
      			tbl = table.open("badge",FILE_RW_SHARED)
      			query.filter = "Badge_id = Var->vBadgeId"
      			query.order = ""
      			query.options = ""
      			qBadge = tbl.query_create()
      			rBadge = qBadge.records_get() 
      			if rBadge = 0 then 
      				ui_msg_box("Warning","Could not find record that matches filter expression: '" + query.filter+"'.",UI_STOP_SYMBOL)
      				qBadge.drop()
      				tbl.close()
      			else if rBadge >= 1 then 
      				vRptNm = alltrim(tbl.Report_name)
      				vPage2 = alltrim(tbl.File_directory)
      				qBadge.drop()
      				tbl.close()
      			end if
      				'Print here
      				query.filter= filter
      				query.order ="FirstName"
      				Dim vSaveFolder as c = "\\cpu7\Teamwork\data\page1.pdf"
      			        :report.SaveAs(vRptNm,"pdf",query.filter,query.order,vSaveFolder,.f.)	
      				var->vMrgFile = "\\cpu7\Teamwork\data\pageCombine.pdf"
      				pdf_merge(vSaveFolder,vPage2,var->vMrgFile,.t.,.f.)
      				
      				'Open file by PDF 
      				if file.exists(var->vMrgFile) then 
      					sys_open(var->vMrgFile) 
      				else
      					ui_msg_box("Error Opening File","File "+var->vMrgFile +  "does not exist.",ui_stop_symbol)
      				end if 
      		else	
      			:report.preview(vLists,filter)
      	  	end if   
      	else
      		goto repeating    
      	end if
      Thank you

      Comment


        #4
        Re: OLE Automation Error

        Stan,

        I just changed the my "File_directory" record at the table and realized that my code does not recognize (or refreshed) the "File_directory" record.

        When I changed "File_directory" field value on the "0002" to same as the record "0001" then the code ran well.

        When I changed "File_directory" field value on the "0002" to another record, the code generated an error.

        Badge Table.jpg

        Comment


          #5
          Re: OLE Automation Error

          Try changing

          query.filter = "Badge_id = Var->vBadgeId"

          to

          query.filter = "Badge_id = "+quote(Var->vBadgeId)

          That's probably not the problem given that the script runs if you use different values. Have you verified that the pdf file named in the file_directory field in record "0002" is not corrupted? It will open normally using Acrobat?
          Last edited by Stan Mathews; 04-27-2012, 09:26 AM.
          There can be only one.

          Comment


            #6
            Re: OLE Automation Error

            Stan,

            Have you verified that the pdf file named in the file_directory field in record "0002" is not corrupted? It will open normally using Acrobat?
            I will try another PDF file. How do I know that was corrupted or not?

            Comment


              #7
              Re: OLE Automation Error

              If you can't open it normally using Acrobat Reader or some other pdf viewer.
              There can be only one.

              Comment


                #8
                Re: OLE Automation Error

                Stan,

                I revised my code, Just opening the "File_directory" value, and It opened the PDF files without an Erro


                vRptNm = alltrim(tbl.Report_name)
                vPage2 = alltrim(tbl.File_directory)
                'Test just open the file
                if file.exists(vPage2) then
                sys_open(vPage2)
                else
                ui_msg_box("Error Opening File","File '"+vPage2+"' does not exist.",ui_stop_symbol)
                end if

                Comment


                  #9
                  Re: OLE Automation Error

                  I suppose that would account for the ole error, trying to open a pdf that did not exist............
                  There can be only one.

                  Comment


                    #10
                    Re: OLE Automation Error

                    Stan,

                    Does it cause by the File Directory address(?) problem?

                    I switched another PDF files then all of my table record "0001 or 0002" were created the ERROR.

                    Should I use "\\cpu7\...... , server directory " or "c:\File_name\...... , "

                    Comment


                      #11
                      Re: OLE Automation Error

                      As far as I know unc paths are supported.

                      This works fine here.

                      sys_open("\\bgfs01\data\Executive\HDB\A5 Updates\filter ideas.txt")
                      There can be only one.

                      Comment


                        #12
                        Re: OLE Automation Error

                        Stan,

                        I do not have any problem to open the PDF files with Sys_open("file_directory").

                        My problem is with this code.

                        'Print here
                        query.filter= filter
                        query.order ="FirstName"
                        Dim vSaveFolder as c = "\\cpu7\Teamwork\data\page1.pdf"
                        :report.SaveAs(vRptNm,"pdf",query.filter,query.order,vSaveFolder,.f.)

                        var->vMrgFile = "\\cpu7\Teamwork\data\pageCombine.pdf"

                        pdf_merge(vSaveFolder,vPage2,var->vMrgFile,.t.,.f.)

                        Comment


                          #13
                          Re: OLE Automation Error

                          Probably time to stick a debug(1) in the script and examine the values in your variables.

                          Therse perform equally well here.

                          Code:
                          pdf_merge("H:\executive\public\bad robot.pdf","H:\executive\public\daily.pdf","H:\executive\public\daily_result.pdf")
                          pdf_merge("\\bgfs01\data\executive\public\bad robot.pdf","\\bgfs01\data\executive\public\daily.pdf","\\bgfs01\data\executive\public\daily_result.pdf")
                          There can be only one.

                          Comment


                            #14
                            Re: OLE Automation Error

                            Stan,

                            This is my test result

                            Code:
                            dim vBaseFile as c ="C:\contractor.pdf"
                            dim vMergeFile as c ="C:\test Letterhead.pdf"
                            dim vResultFile as c '="C:\Result.pdf"
                            
                            
                            
                            'Pdf_Merge(vBaseFile, vMergeFile )
                            
                            ? Pdf_Merge("C:\contractor.pdf","C:\test Letterhead.pdf")
                            ERROR: OLE Automation Error. Source is CDINTF~1."
                            Error opening PDF document"
                            Last edited by Al Buchholz; 04-30-2012, 03:17 PM. Reason: code tags instead of quote tags.

                            Comment


                              #15
                              Re: OLE Automation Error

                              Can you send me the two pdf files? Or attach them here?
                              There can be only one.

                              Comment

                              Working...
                              X