ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calling Macro - Will it take variables? (https://www.excelbanter.com/excel-programming/331751-calling-macro-will-take-variables.html)

Andibevan[_2_]

Calling Macro - Will it take variables?
 
Hi All,

The following piece of code when included in my macro works perfectly

Application.Run "PVCS_cmdGetRevision(""C:\Program
Files\PVCS\vm\common\SampleDb\archives\Test\Test Folder 1\Test File
1.txt-arc"",""Test File 1.txt"")"

When I try to replace the file name and addresses with variables it does not
(Error = Expected function or variable) :-

Var_SelectedFile = "C:\Program
Files\PVCS\vm\common\SampleDb\archives\Test\Test Folder 1\Test File
1.txt-arc"
Var_workfile = "Test File 1.txt"

Application.Run PVCS_cmdGetRevision(Var_SelectedFile, Var_workfile)

What am I missing???

Ta

Andi



Rob

Calling Macro - Will it take variables?
 
'could you use:
Call PVCS_cmdGetRevision(Var_SelectedFile, Var_workfile)
'or
PVCS_cmdGetRevision Var_SelectedFile, Var_workfile




"Andibevan" wrote:

Hi All,

The following piece of code when included in my macro works perfectly

Application.Run "PVCS_cmdGetRevision(""C:\Program
Files\PVCS\vm\common\SampleDb\archives\Test\Test Folder 1\Test File
1.txt-arc"",""Test File 1.txt"")"

When I try to replace the file name and addresses with variables it does not
(Error = Expected function or variable) :-

Var_SelectedFile = "C:\Program
Files\PVCS\vm\common\SampleDb\archives\Test\Test Folder 1\Test File
1.txt-arc"
Var_workfile = "Test File 1.txt"

Application.Run PVCS_cmdGetRevision(Var_SelectedFile, Var_workfile)

What am I missing???

Ta

Andi




K Dales[_2_]

Calling Macro - Will it take variables?
 
Looks like you are missing the quote marks:

Application.Run "PVCS_cmdGetRevision(""" & Var_SelectedFile & """, """ &
Var_workfile & """)"


"Andibevan" wrote:

Hi All,

The following piece of code when included in my macro works perfectly

Application.Run "PVCS_cmdGetRevision(""C:\Program
Files\PVCS\vm\common\SampleDb\archives\Test\Test Folder 1\Test File
1.txt-arc"",""Test File 1.txt"")"

When I try to replace the file name and addresses with variables it does not
(Error = Expected function or variable) :-

Var_SelectedFile = "C:\Program
Files\PVCS\vm\common\SampleDb\archives\Test\Test Folder 1\Test File
1.txt-arc"
Var_workfile = "Test File 1.txt"

Application.Run PVCS_cmdGetRevision(Var_SelectedFile, Var_workfile)

What am I missing???

Ta

Andi




Andibevan[_2_]

Calling Macro - Will it take variables?
 
Thanks to you both - sorted now :-)

"K Dales" wrote in message
...
Looks like you are missing the quote marks:

Application.Run "PVCS_cmdGetRevision(""" & Var_SelectedFile & """, """ &
Var_workfile & """)"


"Andibevan" wrote:

Hi All,

The following piece of code when included in my macro works perfectly

Application.Run "PVCS_cmdGetRevision(""C:\Program
Files\PVCS\vm\common\SampleDb\archives\Test\Test Folder 1\Test File
1.txt-arc"",""Test File 1.txt"")"

When I try to replace the file name and addresses with variables it does

not
(Error = Expected function or variable) :-

Var_SelectedFile = "C:\Program
Files\PVCS\vm\common\SampleDb\archives\Test\Test Folder 1\Test File
1.txt-arc"
Var_workfile = "Test File 1.txt"

Application.Run PVCS_cmdGetRevision(Var_SelectedFile, Var_workfile)

What am I missing???

Ta

Andi







All times are GMT +1. The time now is 12:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com