I'm writing a C++ code with WINAPI() and I need to print many excel documents by using the ShellExecute() function as shown below:
ShellExecute(NULL,"print","c:\\printdocs\\test1.xls",NULL,NULL,SW_SHOWNORMAL);
The above command works fine and prints the Excel document, but the particular excel document is getting opened and an alert message is getting displayed saying 'Do you want to save the changes you made to test1.xls' for every excel document.
Here I don't want the excel sheet to be opened and I need to bypass the alert display so that the all excel documents are printed silently in the background. Please tell me how to print the excel documents silently in the background using shellExecute().
Related
Our application runs on oracle 10g. When we want to print a report after filling the oracle form fields we do the following process:
1. save the file (when it is saved it opens in a new tab)
2. hit control+p (print preview is shown)
3. hit enter (command goes to printer)
Now we want to directly send command to the printer so that the print preview is not shown at all.
You can accomplish this by using the ORARRP utility. Unfortunately, you must have access to Oracle Support to view this support document.
Note that the bottom of the support document specifies a change to orarrp.ini to prevent the print preview from showing.
https://support.oracle.com/rs?type=doc&id=277431.1
I am working on a windows project using VB Script (I am currently writing it in notepad). It is a file selector and I want the user to select a file and the script to remember the file selected. The way I found how to do this is to use a userform. The only tutorials that I found are done in an Excel environment and didn't seem applicable to a non-Excel script. Is there a way for me to use a userform in my program? If not, I just want a dropdown message box that allows a user to select a row and for the script to remember the selection.
I'm using the Easy Print VI to print my application front panel. But I'm unable to predefine the filename and auto save it.
The "Save report to File.vi" let's you specify the name of the VI. Note that this VI does NOT work with a standard report, but with HTML. I do not have the report generation toolbox so cannot test for the rest.
Another way is to print the report with a PDF printer. I get a pop-up dialog with the standard Microsoft PDF printer but that is probably avoidable with better PDF printers.
Problem: Need to read/capture the text of Windows pop-up messages that is generated by non-VB applications.
Situation:
I've a VB6 app, part of which requires processing an excel workbook. A non vb-6 pop-up window (as attached screen) "FILE CONVERSION IN PROGRESS" comes up, while opening an new version of excel-sheet from an old MS Excel app. And automatically it closes alos.
Requirement: I want to capture that pop-up occurance in the code. And then write a conditional statement code for the 'cancel' button click event of that non vb-6 pop-up.
Can anyone suggest something?
You can access other applications with the following APIs:
FindWindow() to locate the main window of what you're looking for
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633499%28v=vs.85%29.aspx
GetWindow() to navigate through the HWNDs of the application so you can get to the button
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633515%28v=vs.85%29.aspx
GetWindowText() to access the text from a control (it cannot be an Edit control)
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633520%28v=vs.85%29.aspx
You'll want to use Spy++ (which can be downloaded) to see what the class name you're looking for when it comes up and to figure out the hierarchy to navigate properly.
You'll need to use the API Text Viewer to get the API declarations so you can use them in VB6 properly.
I can launch Excel with the document I want using VB.Net 2010:
Dim p As New System.Diagnostics.Process
p.StartInfo.FileName = "c:\temp\myfile.xlsx"
p.Start()
Excel starts OK with the file opened. I edit the file, but when I close it down, Excel doesn't ask if I want to save changes. So it closes and loses my edits.
If I do the same with a text file:
Dim p As New System.Diagnostics.Process
p.StartInfo.FileName = "c:\temp\myfile.txt"
p.Start()
It opens (in Notepad++), I edit it and close it, and Notepad++ asks if I want to save changes. Great!
I've now tried similar code with a Word document - and that's OK. Also with an OpenOffice Sheet document and that works as well.
This behaviour is happening in Windows 7 with Excel 2010. It works as expected in Windows XP with Excel 2007.
What am I doing wrong with Excel? Is it me?
I couldn't recreate your error. I ran the app with and without Excel already being open. I closed out of Excel and then by just closing the workbook only. I was prompted to save each time.
You may need to check your settings in Excel. Could be a security setting. Are you doing any other changes to the excel file programatically or are they just manual changes through the Excel UI only?
Maybe SuperUser.com can help.
OK, so it's not related to the way I was opening the document (using System.Diagnosis.Process). I initially thought it was. If I open files via Explorer, edit them and close Excel, it doesn't ask to save the changed file. So it's not a programming issue.
Thanks for the help anyway guys.
Dave