Excel Macro Code issue

Hi All,

This is a part of my excel macro where it opens a text files from mentioned path.I want to pass the directory path where the file is present from a paramter through the execute macro activity.Can you please help the changes i have to do in this macro?
The highlighted part should come through as paramter from Macro Activity.
Thanks

Hi @JITU99 ,

Use execute macro activity in UiPath and it is having option that we can pass parameter. In our case we have to pass file path as parameter.

For this you have to modify your code little adding Filepath As string in your macro function and replace this Filepath to your hardcode file path in your macro code.

Please review the below thread it is having detailed steps on how to pass parameter to macro and how to modify our macro code. I hope it will helpful to your requirement. Thanks.

Hi @kirankumar.mahanthi1 Thanks for your reply my issue here is how to implement that macro code and i tried some methods but it is failing not sure about the syntax to follow.(i had gone through the process already)

Hi,

Could you share your requirement and what you are trying to achieve with macro code. I suggest we should go for vb code so that we can handle it in invoke code activity and we don’t need to use execute macro. Thanks.

It’s simple i have to use a variable as you said in the attached vba code(screenshot is in thread).But dont know how to implement it.

Hi,

Did you tried like below. thanks.

Sub Formatting(FilePath As String)

With ActiveSheet.QueryTables.Add(Connection:=“TEXT;” + FilePath, Destination:=Range(“$A$1”))

Hey Kiran It worked :slightly_smiling_face: Thanks for helping out.

1 Like

Hi,

i could see that you marked solution for your last message. if possible Could you pls mark my suggestion as solution for your issue if you think it helped you to resolve the issue. thanks.

I had correctly marked now Thanks!

Thanks buddy. Your welcome. it is nice connecting with you.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.