Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7944891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:41:17+00:00 2026-06-04T00:41:17+00:00

I need to create a VBA Macro in Excel. The task is that when

  • 0

I need to create a VBA Macro in Excel.

The task is that when a button is clicked a command will be executed in cmd.

The command to be executed is rfrompcb and it takes the path of a file as argument so there is the first level string which wraps the path up as it contains spaces. As this command is to be executed in cmd there is the second level string, which is the argument for cmd command, i.e. cmd /c "rfrompcb ""file_path""" (I hope I have got this one right). Then since it is to be called by Shell in VBA there is the third level string which wraps the cmd command and serves as the argument for Shell.

My question is: How many double quotation marks should there be? I am quite confused about what the final command line string would look like. Can anyone show me how to construct such string? Or is there another way to do it which involves less string nesting?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:41:18+00:00Added an answer on June 4, 2026 at 12:41 am

    You would only need to quote file_path, for example:

    shell environ$("COMSPEC") & " /c dir ""c:\program files\"" /b"
    

    environ$("COMSPEC") just returns the full path for cmd.exe.

    If the executable path you wish to run does not need to be quoted then to pass it an argument that does need to be quoted:

    Shell Environ$("COMSPEC") & " /c rfrompcb ""file path"""
    

    If the exe path does need to be quoted you need to wrap it all in another pair of quotes so it looks like:

    cmd.exe /c ""c:\path to\rfrompcb" "file path""
    

    Which can be done:

    Shell Environ$("COMSPEC") & " /c """"c:\path to\rfrompcb"" ""file path""""" 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a macro in VBA for Delmia. That macro need to
I need to create a script that extracts some data from a complex Excel
I have an Excel file that has a bunch of VBA and macro code
Need to create a custom DNS name server using C which will check against
I need to create a Chart which will grab data from external sources when
Sorry for my Noobness with Excel/Vba... coming from a unix world...I need help! I
Is it possible in a VBA function (UDF) to create an object that has
I'm trying to create a macro that produces in-cell graphing as seen over at
I'm working on a Word 2007 template with a macro that will apply character
I need to create a column chart from values that I have stored in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.