scottleger4
New Member
- Joined
- Oct 3, 2016
- Messages
- 41
- Office Version
- 365
- Platform
- Windows
I'm trying to modify an existing macro that interacts with Host Explorer to essentially reset a connection prior to executing the remainder of the macro. Manually, I would do this action by pressing, in sequence individually, "ALT - F - D - ALT - F - T" as these are the keystrokes/hotkeys to "disconnect" and "connect". Borrowing some code from a different working macro I thought it would be as easy as...
Dim MyHost As Object
Dim HE As Object
Set HE = CreateObject("HostExplorer")
Set MyHost = HE.CurrentHost
Dim RC As Integer
RC = MyHost.Runcmd("ALT")
RC = MyHost.keys("F")
RC = MyHost.keys("D")
RC = MyHost.Runcmd("ALT")
RC = MyHost.keys("F")
RC = MyHost.keys("T")
...but that doesn't work as I expected. How would I write this macro to essentially simulate specific key strokes to accomplish the same thing as I do manually on my keyboard? Thanks in advance.
Dim MyHost As Object
Dim HE As Object
Set HE = CreateObject("HostExplorer")
Set MyHost = HE.CurrentHost
Dim RC As Integer
RC = MyHost.Runcmd("ALT")
RC = MyHost.keys("F")
RC = MyHost.keys("D")
RC = MyHost.Runcmd("ALT")
RC = MyHost.keys("F")
RC = MyHost.keys("T")
...but that doesn't work as I expected. How would I write this macro to essentially simulate specific key strokes to accomplish the same thing as I do manually on my keyboard? Thanks in advance.