Open Website and (3) Folders using a Command Button

O177812

Board Regular
Joined
Apr 16, 2015
Messages
82
Office Version
  1. 365
  2. 2021
Hi,

I would like to create a CMD button that when clicked opens a website and (3) File Explorer folders and a MS Word doc.
I have scoured the internet but I am at a loss.

Website: www.Overstock.com

Folder locations:
1. P:\word documents\INW Group\WORKING\ARCHIVE
2. P:\word documents\INW Group\WORKING\NEXT PO
3. P:\word documents\INW Group\WORKING\PROCESS

WORD DOC: P:\word documents\INW Group\WORKING\Shipping_Invoicing Instructions.docx

Any help or advice would be greatly appreciated!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Give this try, then if it works as intended, just apply "test" to a command button.
VBA Code:
Sub test()
    Const CommonPath As String = "D:\word documents\INW Group\WORKING\"

    'Open Web
    Dim HPurl As String
    HPurl = "www.Overstock.com"
    'By Chrome ok?
    CreateObject("WScript.Shell").Run ("chrome.exe -url " & HPurl)

    'Open Folders
    Dim arr, folder
    arr = Array("ARCHIVE", "NEXT PO", "PROCESS")
    For Each folder In arr
        Call openFolders(CommonPath & folder)
    Next

    'Open Word Doc
    Dim wdapp As Object, wddoc As Object
    Set wdapp = CreateObject("Word.Application")
    wdapp.Visible = True
    Set wddoc = wdapp.Documents.Open(Filename:=CommonPath & "Shipping_Invoicing Instructions.docx")
End Sub

Sub openFolders(ByVal path As String)
    Dim fso As New FileSystemObject
    Shell "C:\Windows\Explorer.exe " & path, vbNormalFocus
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,047
Messages
6,122,858
Members
449,096
Latest member
Erald

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top