Ready, steady… save!
You don’t need a chart to join in. Here are 2 ways to record your savings:
1. Cross it off
Pop a chart into your first post. Saved an amount? Cross it out! Read more »
£0.01 £0.02 £0.03
2. Write it down
Skip the chart and add updates to your first post. Read more »
“Another +£3 saved today. Go me!”
Use +£ before each new saving so it counts towards your total.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
Problem launching Excel from command line
rmg1
Posts: 3,159
Forumite
in Techie Stuff
Hi all
I need to be able to schedule a task to launch Microsoft Excel using a batch file which is attached to a scheduled task.
I also need it to enable macros as our system policy won't allow macros security to be set on "low" (and i's not recommended anyway).
Enabling macros will allow the spreadsheet to update links, publish and exit on its own (I've got that bit working), I just need the batch file command to automate the whole think from start to finish.
I can't leave the Excel file open all the time and use the "Application.Ontime" command as the server closes all the files down overnight to prevent problems.
Anyone any ideas?
I need to be able to schedule a task to launch Microsoft Excel using a batch file which is attached to a scheduled task.
I also need it to enable macros as our system policy won't allow macros security to be set on "low" (and i's not recommended anyway).
Enabling macros will allow the spreadsheet to update links, publish and exit on its own (I've got that bit working), I just need the batch file command to automate the whole think from start to finish.
I can't leave the Excel file open all the time and use the "Application.Ontime" command as the server closes all the files down overnight to prevent problems.
Anyone any ideas?
:wall: Flagellation, necrophilia and bestiality - Am I flogging a dead horse? :wall:
Any posts are my opinion and only that. Please read at your own risk.
Any posts are my opinion and only that. Please read at your own risk.
0
Comments
-
Experiment with the following batch file lines:
to open excel
start /d "C:\Program Files\Microsoft Office\Office" EXCEL.EXE
or to open an excel file
start /d C:\finance\spreadsheets budget.xls
:doh: Blue text on this forum usually signifies hyperlinks, so click on them!..:wall:0 -
The comman you need to run in the batch file to open Excel with the workbook is
excel.exe "c:\pathtothefile\workbookname.xlsm"
This will open the file but as you will see the file will still have macros disallowed. I don't belive there is a command line switch to change this, however the defualt setting of Disable all macros with notification will not apply to digitally signed projects that are from trusted publishers.
To get your self a digital certificate here are the instructions
Once you have done this sign your VBA project by going to the Visual Bassic window and Tools>Digital Signiture and selecting the one you have just set up.
You then need to go to excel and open the file you will get the usual warning but with the option to add the publisher to the trusted publishers. Select this and you should be able to open the file from the above command line with the macros automatically enabled.
Hope that makes senseThe only way of finding the limits of the possible is by going beyond them into the impossible.
Arthur C. Clarke0 -
Thanks guys.
Should have remembered about digital signatures as I've used them before (doh!)
:wall: Flagellation, necrophilia and bestiality - Am I flogging a dead horse? :wall:
Any posts are my opinion and only that. Please read at your own risk.0
This discussion has been closed.
Confirm your email address to Create Threads and Reply
Categories
- All Categories
- 355.9K Banking & Borrowing
- 255K Reduce Debt & Boost Income
- 456.2K Spending & Discounts
- 248.4K Work, Benefits & Business
- 606.1K Mortgages, Homes & Bills
- 179K Life & Family
- 263.9K Travel & Transport
- 1.5M Hobbies & Leisure
- 16.2K Discuss & Feedback
- 37.7K Read-Only Boards