Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use function from VBScript
#1
How can I save the value of this VBScript function into a str please
Format(Month(Now)-3, "00")& Year(Now)
#2
Macro Macro59
Code:
Copy      Help
str vbs=
;Format(Month(Now)-3, "00")& Year(Now)

str s1=VbsEval(vbs)
out s1

But error: Type mismatch: 'Format'
Does VBScript have function Format? I guess it is a Visual Basic 6 function.
#3
Sorry, you are right... then how can I get the result of this c# variable (first):

Code:
Copy      Help
var today = DateTime.Today;
var month = new DateTime(today.Year, today.Month, 1);      
var first = month.AddMonths(-3);
#4
Look in menu File / New / Templates / Scripting.

Macro Scripting C#, call single static function4
Code:
Copy      Help
str R=CsFunc("")
out R


#ret
//C# code
using System;

public class Test
{
public static string TestFunction()
{
var today = DateTime.Today;
var month = new DateTime(today.Year, today.Month, 1);
var first = month.AddMonths(-3);
return first.ToString();
}
}
#5
Thank you very much


Forum Jump:


Users browsing this thread: 1 Guest(s)