LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MS office report not working when application is compiled (application builder)

I'm finishing up an application that includes several MS office reports (opens a MS Word template). The template is opened, the bookmarks are filled, then the file is saved (to our internal network) as a .doc file. The New Report.vi is used to open the .doc file, the Print Report.vi is used to print the file, then the SMTP send file.vi is used to email the file.

Everything has been working fine then I decided to build the application for distribution. Big mistake! An installer is made. When I install the application I get "File not found" (error 7) errors each time I attempt to run this section of code. Incidentally, This app. also uses the SQL database toolset to read and write to a database. No problems with the database.

I thought it might have something to do with the Word templates being on the network. I copied everything to my local PC and built another application. Same problems.

I suspect I'm doing something wrong in the Source Files tab of the Build Application or Shared library window.

I'd really appreciate your help.

thanks,

todd
Message 1 of 8
(4,247 Views)
Most likely, you're looking at a path problem to the template file from the applicaiton.

When you build a VI into an applicaiton, the path to that applicaiton changes. If originally the VI that calls the template file was located "c:\app\caller.vi", after you build the executable, that same VI will now be located at "c:\app\toplevelVI.exe\caller.vi".

The executables name will now actually be a part of the path. So you may need to add an extra "Strip Path" function somewhere to get you to the real path to the Excel file. Of course this is just a guess without seeing your code. You could try going back to the LabVIEW code and add a path indicator where you are building the path, then re-build the application and run it so you can see what the path is after it's built.

Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 2 of 8
(4,233 Views)
I've had a similar problem although I had even HARD-CODED the complete path to the template in my call to the MS Office Report VI, e.g. "C:\Program Files\MyApp\Template1.xlt".  When I built the app. it couldn't find the template, even though it was in the right location.  I just started experimenting and found that if I move the template to the \data folder that the installer created it works!  That is, the template is now at "C:\Program Files\MyApp\data\Template1.xlt".  I would consider this a BUG!
0 Kudos
Message 3 of 8
(4,091 Views)

Hi Kilgore,

You're right, we do force the template to be in the 'data' folder for an EXE, even if the hard-coded template path you specified is valid.  I will do my best to make sure this problem is fixed in the next release of the Report Generation Toolkit. 

Sorry for the inconvenience,

-D

P.S. - For now, you can fix the problem by copying over the following VI with the one I've attached to this message:  vi.lib\addons\_office\MSOfficeReportBlock.llb\ex_RGT_EXE Path Fix.vi

Message Edited by Darren on 02-01-2006 10:54 AM

0 Kudos
Message 4 of 8
(4,088 Views)
Thanks for your quick response, Darren.  I should have posted to the discussion group for help BEFORE I figured it out by trial and error.  I might still have a bit more hair if I had.Smiley Happy
 
Ed
0 Kudos
Message 5 of 8
(4,067 Views)

Does anybody know if this has been corrected? I have a similar problem, whereby after the exe. is compiled, the report functionality is gone, although everything else is pretty skippy at this point. I am using lv 8.2 with the report writer tool kit, and the ms office report vi. The connections are shown in the first picture, and the set up is shown in the second picture. I can enclose the code, but it links back to a bunch of cfp, and will error out without the hardware. Coincidently, I am trying to put in an error window, but I can't seem to figure out the right format to read back the error codes. Any help would be appreciated.

Thanks;

Sig.

Download All
0 Kudos
Message 6 of 8
(3,846 Views)

Let me add another question, do I have to re-write the path in the original VI to go to the National Instruments prescribed path (ie /myapp/data/template) or do I have to add a new folder in my original folder to which my VI is currently pointed (ie desktop/owner/codefolder/template to desktop/owner/codefolder/data/template?)

I appreciate your help and thoughts.

Sig.

0 Kudos
Message 7 of 8
(3,831 Views)
Sig,

As we discussed on the phone, and for the benefit of anyone who may stumble upon this thread with a similar problem in the future, the following KnowledgeBase article addresses the problem you were having: Error 7 When Running an .EXE Using VIs from Report Generation Toolkit for MS Office.  If you still receive error messages that point to other missing files after following these steps, it may be neccessary to add other VIs from the libraries located in the LabVIEW\vi.lib\addons\_office\ directory.

Regards,
0 Kudos
Message 8 of 8
(3,797 Views)