From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
11-22-2016 02:31 PM - edited 11-22-2016 02:32 PM
Hello all,
I want to print a report using Excel worksheet functions. I've already managed to change height, width of columns, alignment
of cells, but I still haven't find how to fit the current worksheet to the selected size of paper.
Does someone knows if this is possible? You see in excel or word when you're about to print, there's an option called
"fit to paper"; this option comes in handy when the Excel file has lots of column and you want print that, using only
1 page, not matter the size of the font size (as longs as it's readable)
Im attaching the block diagram of my current VI.
For what I want do I have to call the ActivEx functions?
Please any advice!!
Solved! Go to Solution.
11-22-2016 03:00 PM
Use Excel Get ActiveX References and wire the references to access ActiveX properties that aren't exposed by the Report Generation VIs.
11-22-2016 04:12 PM
Just one question. What does numeric number "1" does in the method PAGE SETUP? Before running the VI, I had the zoom in TRUE and I had an error in screen also. Could you explain me this two little details? I want to start using more ACTIVEX, seems that these functions are highly useful.
Do you know any literature that I could use to learn more about using ACTIVEX in LabVIEW??
Many, many thanks for you help!!!
I attached the image with the error, when using TRUE in ZOOM input.
11-22-2016 04:20 PM
I believe "1" represents the number of pages your sheet will print to. I took the values from Microsoft's help pages:
Based on the documentation for Zoom:
If this property is False, the FitToPagesWide and FitToPagesTall properties control how the worksheet is scaled.
Look here for info on calling ActiveX objects in LabVIEW:
http://zone.ni.com/reference/en-XX/help/371361N-01/lvconcepts/using_activex_with_labview/
The steps boil down to opening a reference and calling properties or methods provided by the ActiveX object.
11-22-2016 04:30 PM
Thanks for your help, I really appreciate your time.
11-22-2016 05:28 PM
Next time you need to implement an ActiveX function that you know exists in Excel, but don't know where to find, here is a trick.
1. Open Excel
2. Record a macro
3. Manually make the change to the workbook
4. Stop the macro
5. View the code
This will reveal the exact syntax and object hierarchy needed in LabVIEW to make the same function. If you know the function name, you can also search the Excel Visual Basic for Applications window using the object browser. Attached is the macro generated by setting the Fit to 1x1.
11-23-2016 07:09 AM
Thanks for the advice man!! \m/
11-23-2016 08:43 AM
@pangvady wrote:I believe "1" represents the number of pages your sheet will print to. I took the values from Microsoft's help pages:
It sets the number of pages tall or wide to which the worksheet will be scaled when it's printed (according your worksheet is tall or wide enough to cover these amount of pages, if you have a single column it will not print 2 pages wide).
Ben64