LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save excel to Pdf error

Solved!
Go to solution

I am trying to save an excel file to PDF but it was error at the end,could someone can point me out where is the problem?

Thanks

 

Download All
0 Kudos
Message 1 of 10
(2,401 Views)

Have you seen this post:

https://forums.ni.com/t5/LabVIEW/Error-214682728-4/td-p/2638269

 

You can search: LabVIEW error 0x800A03EC

 

 

 

George Zou
0 Kudos
Message 2 of 10
(2,361 Views)

Double check the application ref wired to the Automation Open.  Make sure it's Excel.Application

 

George Zou
0 Kudos
Message 3 of 10
(2,348 Views)

Hi,
I think a plug-in/add-on is required to save excel file to pdf. By default, it may not be possible. Try to save the file as pdf using excel application to verify.

bp
0 Kudos
Message 4 of 10
(2,333 Views)

Do you have LabVIEW's Report Generation Toolkit (which gives you access to Excel) installed?  (It may require an additional license).  Many (!) years ago, when I was first learning LabVIEW, I tried working with Excel without using the Toolkit (which I had, but didn't know what it was for) -- what a nightmare!  I suspect it would be much easier (and probably do-able) using the RGT.

 

[Something happened -- I wrote this at 7 am, thought I posted it, but it didn't "go".  When I came back this afternoon, no post, but "saved in the Ether" was the beginning of my reply, above.  I now have some additional information ...]

 

Although I haven't tried this, I believe the RGT will allow you to do this, but it will be a bit of work (probably not too bad, and I might try it myself, and if I succeed and noone else finds this, I'll post it here].  The "trick" is that the RGT allows you, under "Excel Advanced", to create (and run) Excel Macros.  You need to write a Macro to print your Report to a PDF, then run the Macro.  I haven't, myself, tried this, but if it works, it should be simpler than the code you posted ...  Of course, without the RGT, you need to do "something else".

 

Bob Schor

 

P.S. -- I found, on the Web, the VBA code for creating an Excel Macro to output a WorkSheet as a PDF.  For right now, this looks like a little more work than I want to do, but I'm happy to point out that the knowledge is out there.  One link that looked reasonable was this one ... 

 

0 Kudos
Message 5 of 10
(2,319 Views)
Solution
Accepted by 314159ym

Your code appears to be using the Worksheet SaveAs method, which I'm not sure is capable of saving a PDF output as you want.  I've had success with the ExportAsFixedFormat method for this.  If you follow my posting on this thread, you may get what you want.  I wrote the code linked there to work directly with a Report class wire, and it will adapt to Excel or Word variations of ExportAsFixedFormat.

 

Good luck!

 

Dave

David Boyd
Sr. Test Engineer
Abbott Labs
(lapsed) Certified LabVIEW Developer
Message 6 of 10
(2,307 Views)

I tried as you told "ExportAsFixedFormat" but still not working😂  Error code is "unknown system error"

0 Kudos
Message 7 of 10
(2,274 Views)

Use  LabVIEW's Report Generation Toolkit might works ,i try tihis later thanks 

0 Kudos
Message 8 of 10
(2,270 Views)

I tried it works like this way 

 

Thanks 

0 Kudos
Message 9 of 10
(2,251 Views)

I will describe two additional issues to watch out for - and this really applies to both the Report Generation Toolkit, as well as "do it yourself" automation of Excel - that I, and others here, have noticed.

 

1) At least in more recent versions of Excel, there are both "standalone" and "Office 365" installations, and though their ActiveX interface methods seem the same throughout, there are a few small differences - one of which is the ExportAsFixedFormat method.  For Office 365, it gains an extra input parameter ("WorkIdentity") at the bottom of its node list.  I ended up putting a Type Specialization structure around the Excel call to this node and placed both variations in two cases (I had to load the code twice, under varying Office installations, to capture both variations).  This means that the code will load correctly regardless of which Office environment it's in (without a "mutation" & dirty dot, or outright broken arrow).  But it also means that if you build an executable, the target's Office environment is expected to match your dev environment - the rejected case is not compiled in.ExportAsFixedFormat non-O365.PNGExportAsFixedFormat O365.PNG

 

The copy of "Report Export as Fixed Format.vi" I posted September 2021 doesn't have that little improvement, so I'll attach the improved version here.

 

2) I, and others, have found that Microsoft's minor patches to Office seem to end up with the ActiveX interfaces somehow disabled or deregistered.  The symptom of this is that all attempts to use Automation references to Excel will suddenly fail with a generic error.  This of course, affects the Report Generation Toolkit too.  So far for me, an "Office Quick Repair" restores things back to working.  You can review this link to read the gory details.

 

Hope this helps anyone else who is automating Excel (with or without the RGT!).

 

Dave

David Boyd
Sr. Test Engineer
Abbott Labs
(lapsed) Certified LabVIEW Developer
Message 10 of 10
(2,203 Views)