Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


spiderrock
2009-05-04T23:02:38Z
Hello,

I’m struggling with something. I am trying to run an excel file (saved macro) that in any other task scheduler I can just run blah.xlsm

I set it up in Visual cron as a execute task running cmd /c “blah.xlsm”


I can run it in the foreground, via a batchfile etc but every time I start it with Visual cron it errors or gets stuck with no discernable log information. Have you ever had people try to run these directly?

I use the command “C:\WINDOWS\System32\cmd.exe”
And the arguments “/c "Daily Report Utility All.xlsm"”

With the working directory set. I have tried using excel.exe (and start) as the command as well. Ideally id just have visual cron run it as executable.


I have tried via python, batch scripts, the macro function in visual cron and I cannot get these things to run. Can you assist? I have been playing with this for 2 days now!

I am on version 4.9.40
Sponsor
Forum information
Support
2009-05-05T08:56:34Z
Did you try the Excel Macro Task instead?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
spiderrock
2009-05-05T19:05:28Z
Yes, but It does not appear to use .xlsm files.

I was able to run a macro name within an excel sheet, but that does not help me.

Support
2009-05-05T22:26:15Z
Could you attach a very simple .xlsm script. But before that, you should try using the full path to excel.exe in command and full path to your file in the parameter field (together with other parameters). If that still does not work try adding a Credential (local user).
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
spiderrock
2009-05-05T23:20:26Z
I have done it the following sawy where it will run excel but then stall

-Ran excel.exe with a parameter of the xlsm file
-A batch script with start prepended
-A batch script with it starting the macro
-A python script to launch the xlsm file
-The Excel macro

I have used it:
-Background
-Forground
-With a no credentials
-with a domain user its on a domain controller)
-With domain administrator

I will get you some code tomorrow, the file is protected and its my job just to run it. the person who wrote it says "it runs, it runs in task scheduler.." well that is where they start

Thanks,
Alex
Support
2009-05-06T08:07:54Z
Thanks, we will await that test sample.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
spiderrock
2009-05-06T22:58:12Z
Here is a sanitized version.

I am also going to attempt to run the macro by calling the SaveSendReport module directly with the excel macro job type.
spiderrock
2009-05-06T23:01:22Z


Sub SaveSendReport()
'

Sheets("Report Summary").Select

Application.Calculation = xlManual
Application.CalculateUntilAsyncQueriesDone
Application.CalculateBeforeSave = True
ActiveWorkbook.Save
Application.DisplayAlerts = False

'Distribute email with copied files

'ActiveWorkbook.SendMail "", ""

'Clean up File for Distribution

Sheets("Report Summary").Select
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Cells.Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Sheets("Position Risk Summary").Select
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Cells.Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Sheets("Earning Risk Summary").Select
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Cells.Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False

'Remove External Data Links


Sheets("Position Risk Summary").Select
ActiveWindow.SelectedSheets.Visible = False

Sheets("Earning Risk Summary").Select
ActiveWindow.SelectedSheets.Visible = False

Sheets("Industry Detail").Select
ActiveWindow.SelectedSheets.Visible = False

Sheets("Financial Detail").Select
ActiveWindow.SelectedSheets.Visible = False

Sheets("Haircut Calculator").Select
ActiveWindow.SelectedSheets.Visible = False

Sheets("Edge Summary").Select
ActiveWindow.SelectedSheets.Visible = False

Sheets("Contracts Traded").Select
ActiveWindow.SelectedSheets.Visible = False

Sheets("StockRisk Summary").Select
ActiveWindow.SelectedSheets.Visible = False

Sheets("OptionRisk Summary").Select
ActiveWindow.SelectedSheets.Visible = False

Sheets("Industry Def").Select
ActiveWindow.SelectedSheets.Visible = False

Sheets("Long Short Contracts").Select
ActiveWindow.SelectedSheets.Visible = False

Sheets("Stock Risk Summary Ind Table").Select
ActiveWindow.SelectedSheets.Visible = False

Sheets("Sheet1").Select
ActiveWindow.SelectedSheets.Visible = False


'Set-up file directories

filedate = Format(Date, "mm-dd-yyyy")
Sheets("Report Summary").Select

'Delete previous web page file

ChDir "C:\reports"

Kill "C:\reports\report.htm"

'Save new web page

ActiveWorkbook.SaveAs Filename:= _
"C:\reports\report.htm", FileFormat:=xlHtml, CreateBackup:=True

'Save Archive File

ChDir "C:\reportarchive\"

ActiveWorkbook.SaveAs Filename:= _
"C:\reportAchive\report " & filedate & ".xlsx" _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False

'Print file

Sheets("Report Summary").Select
Sheets("Report Summary").PrintOut


'Close the File

Application.Quit

End Sub




Support
2009-05-07T11:17:09Z
Will that compile even though sheets are missing? You don't have document that you could attach?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
spiderrock
2009-05-08T22:47:25Z
can i PM it to you? it compiles in windows by running the xlsm file, thats most of what I know. and that is the macro code with it.

I would prefer not having reports in a public forum
spiderrock
2009-05-08T23:39:15Z
maybe some help on how to run this macro embedded in the sheet as a macro task would help? maybe thats the best way to do this
Support
2009-05-09T00:13:39Z
Please mail it to support@visualcron.com
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top