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 8711513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:53:48+00:00 2026-06-13T04:53:48+00:00

I have added a confirmation dialog to a vbs script (provided by 3rd party)

  • 0

I have added a confirmation dialog to a vbs script (provided by 3rd party) but I do not need to click the “OK” 3 times and would like the confirmation prompt to show only once… In my (limited) knowledge I do not manage to do that, can anybody kindly correct this code?

Set fso = CreateObject("Scripting.FileSystemObject")

a = "C:\Path to file 1\File 1.txt"
b = "C:\Path to file 2\File 2.txt"

RenameItem a, a & ".bak"
RenameItem b, a
RenameItem a & ".bak", b

Sub RenameItem(oldname, newname)
  If fso.FileExists(oldname) Or fso.FolderExists(oldname) Then
If fso.FileExists(oldname) Then Set f = fso.GetFile(oldname)
If fso.FolderExists(oldname) Then Set f = fso.GetFolder(oldname)
f.Name = fso.GetFileName(newname)
  End If
Msgbox "Files were toggled successfully" & vbNewLine & vbNewLine & "(click the ""OK"" button to exit)"
End Sub
  • 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-13T04:53:50+00:00Added an answer on June 13, 2026 at 4:53 am

    RenameItem() is a sub(routine), i.e. a unit of code which can be reused. Every time you call the sub, it executes everything in it, including the MsgBox.

    Move this line outside of the sub:

    Msgbox "Files were toggled successfully" & vbNewLine & vbNewLine & "(click the ""OK"" button to exit)"
    

    Full Code

    Set fso = CreateObject("Scripting.FileSystemObject")
    
    a = "C:\Path to file 1\File 1.txt"
    b = "C:\Path to file 1\File 1.txt"
    
    RenameItem a, a & ".bak"
    RenameItem b, a
    RenameItem a & ".bak", b
    
    Msgbox "Files were toggled successfully" & vbNewLine & vbNewLine & "(click the ""OK"" button to exit)"
    
    Sub RenameItem(oldname, newname)
        If fso.FileExists(oldname) Or fso.FolderExists(oldname) Then
            If fso.FileExists(oldname) Then Set f = fso.GetFile(oldname)
            If fso.FolderExists(oldname) Then Set f = fso.GetFolder(oldname)
            f.Name = fso.GetFileName(newname)
        End If
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As part of the registration process on a website, I have added mail confirmation.
I have added the sdk files like dropbox website says, but I can't figure
I have an attribute that I just added to my database to hold confirmation
I added some confirmation dialog boxes for my Rails 3.1 application and, prior to
Hi I have added active_admin to my rails app. I would like to create
When the user clicks a certain LinkButton, I need to open a confirmation dialog
Firstly I would like confirmation that I have understood NSCopying correctly ... In order
Using Rails 2.3.8. I have added this in my controller: filter_parameter_logging :password, :password_confirmation But
I have added a navigation controller inside a viewcontroller thats inside another navigation controller...
I have added a plugin called scrollpaper to a site I'm working on. The

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.