0

I have a variable in my VBA script and I'm trying to call that variable on the command line within the script.

Sub Test()
'Set enviro to %APPDATA%
Dim enviro As String
enviro = CStr(Environ("APPDATA"))
'Create a new variable that sets the file path for the RepoDir.txt
RepoPath = enviro & "\RepoDir.txt"

'Create a new variable to grab the line of text in RepoDir.txt
Dim FilePath As String
Dim strFirstLine As String

'The new variable calls the RepoPath Variable
FilePath = RepoPath
Open FilePath For Input As #1
Line Input #1, strFirstLine
'MsgBox (strFirstLine)

Shell ("cmd /c cd call strFirstLine & git pull RandomSig > %TEMP%\gitPull.txt 2>&1")

End Sub

I am trying to call the variable strFirstLine which contains a a pathway I want the command line to read and then CD to it. Is there anyway to do this?

Thank you!

1 Answer 1

1

You will want to pass the value of strFirsLine, not the name. Use (example):

Shell ("cmd /c cd " & strFirstLine & "git ..."
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.