How can I suspend macro code until I return to Excel after my macro navigates to a website

jerry12302

Active Member
Joined
Apr 18, 2005
Messages
456
Office Version
  1. 2010
Platform
  1. Windows
I have code to copy a website Login ID, then open Chrome and navigate to a website where I can paste my Login ID to log in. After returning to Excel it still has the Login ID range in copy mode and I have to press Escape. If I add Application.CutCopyMode = False after the code that navigates to the website, I lose the Login ID copy.

How can I have Excel pause macro execution until after I return to Excel?

Here is the code I use (modified to be a sample):

Sub ABC_Website_Login()

Dim chromePath As String
Range("LoginID").Copy

chromePath = """C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"""

Shell (chromePath & " -url https://www.somewebsiteIuse.com/login")

'Need some code here to suspend the macro until I return

Application.CutCopyMode = False

End Sub
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi jerry
This will put the .value of the cell straight into the clipboard and not the whole cell meaning no marching ants to get rid of
VBA Code:
Sub ABC_Website_Login()

Dim chromePath As String
Dim CBoard As Object
Set CBoard = CreateObject("HtmlFile")
  CBoard.ParentWindow.ClipboardData.SetData "text", Range("LoginID").Value

chromePath = """C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"""

Shell (chromePath & " -url https://www.somewebsiteIuse.com/login")

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

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