last day (15 days later) » 

16:03
0
Q: Systematically launch a GUI software in Windows Server

ThomasIn a calculation provided by my Windows server, I have to make Microsoft Excel involve because of technology limitations: I need to systematically open Excel inside the server, read content of an Excel file to generate a txt file, and then close the Excel. To this end, I have installed Microsoft...

What exactly is the problem you are trying to solve? Are you just trying to export .xls to .txt?
Yes, I am trying to converting the content of an .xls to .txt. It is hard to retrieve some contents without opening the file.
Have you tried using powershell instead of batch? With PowerShell you have Export-Csv.
I have done lots of investigation, the conclusion is reading the content of excel file without opening the file is quite limited. I have to open the file with Excel, even thought I don't see it...
Keep in mind of a lot of this is going to depend on how the data in .xls is structured. If you just want columns and rows output to comma separated values, then you really just want to convert .xls to .csv (if you actually output to .txt have you confirmed it will be formatted in the way you need it for whatever reason you want to export .xls to .txt?). If you decide you want to convert to .csv then this may be much simpler.
16:03
I need to read lots of things from an Excel file besides the cell values...
I'm not sure what else you are going to read or what you are trying to with it once it is in the .txt file
what are you actually trying to accomplish (i.e. what is the specific problem)?
I ask only because the solution you are asking for does not seem like it will do what you want it to, but I cannot be certain as I don't actually know what you are trying to do.
Hello
Thanks for asking...
For example, I need to read VBA macros in an Excel file
I need to read cell formulas
you need to read the code of a VBA macro and output the code to .txt?
Yes
hmmm... okay hang on
16:07
then, i will analyse the properties of these things
Yes, I know the existing of these things
but they all need EXCEL to be open
that's why i want to open Excel
well just because you don't see it on the screen doesn't mean it isn't running.
OK....
you would see the process excel.exe in the process list in task manager when it runs
have you tried either of these to see if it works?
16:11
I tried, it works... I could well do that
ok so in that case, you can save the .vbs script and then write a batch file to call the .vbs. Then schedule the batch file.
you can directly run a .vbs script as a scheduled task but some people have problems with that. social.technet.microsoft.com/Forums/en-US/…
Sorry, but why would you want to read macros & formulas, don't you need just the results?
i'm assuming he is trying to backup or make documentation on source code he is using in different Excel files.
I want to analyse properties of these macros & formulas
i'm not sure what you mean by analyse.... are you saying you think they are malicious and you are doing malware analysis on Excel macros?
16:15
they may contain "bugs"
i may want to know if they are complex
etc.
so yeah I think the examples I linked to will take care of what you want.
I guess the .vbs still need to open Excel. So, in your opinion, even though i cannot see Excel launching, it is still launched behind screen?
Obviously the analysis part is still going to be manual
But you can save xls as xlsx, rename it to zip & have all source code right in front of you?
no, the analysis part is automaitc
16:16
ok... so you should be set
Doesn't it work that way?
yes if the .vbs is running and the .txt files are created then you know it works....
also have task manager open when you run the .vbs and look for a process with the name excel.exe
is there any other way to "observe" that exeuction?
such as? and why do you need to observe it?
run a test. if the .txt file is created you know it works. Then schedule the task and let it run.
i don't know, when I don't see the GUI, i am still worried...
16:18
lol
well that really isn't a good enough reason to not run a test.
get a copy of a file and do the test and if it works stop worrying
to Thomas: I guess it is hard to get the VBA macros and formulas from zip & xml format
OK, I will run the test, and keep you updated on stackoverflow...
sorry, on server fault
good luck! :)
I hope your id will still be valid?
to be reached?
the link to the chat room is a comment on the discussion itself
you can always post a new comment or go back to the chat room later
i see...
will let you know...
16:25
Did you know that there is a full-blown VBA IDE with a GUI debugger in Microsoft Office?
i know...
well, maybe i don't know
do you mean the VBA IDE integrated in Excel?
Yeah, that one, which is accessible by adding those buttons in excel options
i know that... I think it is always where people write VBA macros, no?
Yeah, you can then execute them via shell as well stackoverflow.com/questions/2050505/…
just make sure macro runs on workbook_open()
There's also single step mode for debugging support.office.com/en-us/article/…
Thank you for these links
i will look into them...
16:40
As for me, I prefer converting to csv with this toolset csvkit.readthedocs.io/en/0.9.1/tutorial/3_power_tools.html, then importing to MySQL & working from there (it seems like the easiest way (after your macros generated the sheet you need of course))
i see...

last day (15 days later) »