I have variable path(string) = “C:\Users\Titi\Desktop\input\ “+month+”_”+year+“.xlsx”
I want to send path to macro for open file instead of in path square red as below.
Please guide me.
I have variable path(string) = “C:\Users\Titi\Desktop\input\ “+month+”_”+year+“.xlsx”
I want to send path to macro for open file instead of in path square red as below.
Please guide me.
@prasath_S Year and month are not pass to macro as below.
My variable as below.
month = Date.Now.AddDays(-3).ToString(“MMMM”)
year = Date.Now.AddDays(-3).ToString(“yyyy”)
@fairymemay
Maybe something wrong with path.
You can try to first assign a variable = month + “_” + year + “.xlsx” as let’s say “ExcelPath”
Then pass it into the path.
Regards,
Kah Liang
@fairymemay first check if the file is present using path exists activity.
Or first send the file path as hard-coded and not on the variable
send the file path as hard-coded // work completed not error.
From your screenshot it looks like the variables month and year are empty. Have you checked that the path variable looks correct before sending it to the macro? (You can use Write Line to print the variable value to the Output panel to check.)
Thanks! And how does path look?
could you please put path variable in the message box and send what the path looks like
When do you assign the month and year? It should be before the path assignment.
month = Date.Now.AddDays(-3).ToString(“MMMM”)
year = Date.Now.AddDays(-3).ToString(“yyyy”)
path = "C:\Users\Titi\Desktop\input\"+month+"_"+year+".xlsx"
Or could you share your workflow so we can help you troubleshoot?
Your code should be like below
Sub B**(filePath As String)**
Apllication.WindowState = xNormal
Workbook.Open Filename = filePath
Range(“A1:A10”).Select
End Sub
You missed passing the parameter to your method… Also, create the same variable name(filePath) of type string in the studio from where you are passing the path to execute macro activity…
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.