How to add sendkeys CTRL+SHIFT+F4 to existing VBA code for IE?

The below code updates an IE form.  At the end I want to send a CTRL+SHIFT+F4 command to IE to save the form.

Sub WIP_Ticket()

    Dim objIE As SHDocVw.InternetExplorer
    Dim objShell As SHDocVw.ShellWindows
    Dim objIEDoc As MSHTML.HTMLDocument
    Dim objFound As MSHTML.HTMLBaseElement
    Dim strURL As Variant
    Dim blnFoundWebSite As Boolean
    Dim objDialog As FileDialog
    Dim objFSO As Scripting.FileSystemObject
    Dim objText As Scripting.TextStream
    Dim objDebugFile As Scripting.TextStream
    
    Dim varFrame As Variant
    Dim varFrame2 As Variant
    Dim objFrameDoc As MSHTML.HTMLDocument
    Dim objFrameDoc2 As MSHTML.HTMLDocument
    Dim i As Integer
    Dim j As Integer
    
    Dim objElem As MSHTML.HTMLBaseElement
    Dim objElemDoc As MSHTML.HTMLDocument
    Dim objElem2 As MSHTML.HTMLBaseElement
    Dim objElemDoc2 As MSHTML.HTMLDocument

        
    Set objShell = New SHDocVw.ShellWindows
    Set objFSO = New Scripting.FileSystemObject
    ' **** Set the Web Address Here ****
    strURLS = "https://servman/sm/index.do,https://servman/sm/index.do#,https://servman/sm/index.do?lang=en,https://servman/sm/index.do?lang=en&mode=index.do,https://servman/sm/index.do?lang=en&mode=index.do&logout_msg=LogoutPage.session_timeout"
  
    ' Look for the appropriate open IE Window
    For Each objIE In objShell
        If TypeOf objIE.document Is MSHTML.HTMLDocument Then
            Set objIEDoc = objIE.document
            If Not (objIEDoc Is Nothing) Then
                For Each strURL In Split(strURLS, ",")
                    If objIEDoc.url = strURL Then
                        blnFoundWebSite = True
                        Exit For
                    End If
                Next
                If blnFoundWebSite = True Then Exit For
            End If
        End If
    Next
    
    Set objFrameDoc2 = objIEDoc

    If blnFoundWebSite Then
        ' Make sure IE is done loading the page
        Do Until Not objIE.Busy
            DoEvents
        Loop
        
        ' Make Sure we had some frames returned
        If objIEDoc.frames.Length > 0 Then
            ' Get the Document from the 1st Frame
            Set varFrame = objIEDoc.frames.Item(0)
            Set objFrameDoc = varFrame.document
            
            ' Get the Detail Frame (Sub Frame #2)
            If objFrameDoc.frames.Length > 1 Then
                Set varFrame2 = objFrameDoc.frames.Item(1)
                Set objFrameDoc2 = varFrame2.document
                
                'Title
                
                Set objFound = objFrameDoc2.getElementById("X95")
                If objFound Is Nothing Then
                    
                Else
                    Range("K25").Value = objFound.Value
                    objFound.Value = Range("M31")
                End If
                
                'Update
                
                Set objFound = objFrameDoc2.getElementById("X159")
                If objFound Is Nothing Then
                    
                Else
                    objFound.Value = "Beginning assignment process"
                End If
                

                
            Else
               
                'Title
                Set objFound = objFrameDoc.getElementById("X95")
                If objFound Is Nothing Then
                    
                Else
                    Range("K25").Value = objFound.Value
                    objFound.Value = Range("M31")
                End If
                
                Set objFound = objFrameDoc.getElementById("X159")
                If objFound Is Nothing Then
                    
                Else
                    objFound.Value = "Beginning assignment process"
                End If
                
            End If ' objFrameDoc.frames.Length > 1
        End If ' objIEDoc.frames.Length > 0
        
        
        
    End If
    
    'Original Title
    Range("AX75") = Range("M5")
    
    'Save Form
    Application.SendKeys "^+{F4}"

    Set objIE = Nothing
    Set objShell = Nothing
    Set objIEDoc = Nothing
    Set objIEDoc = Nothing
    Set objFound = Nothing
    Set objDialog = Nothing
    Set objFSO = Nothing
    Set objText = Nothing
    Set objDebugFile = Nothing
End Sub

Open in new window

kbay808Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rgonzo1971Commented:
HI,

if you have a button even hidden in the html you could use something like

objFrameDoc.getElementById("Submit4").Click

Regards

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
You are already doing that in line 117 - sending the key stroke to the active window. Doesn't that work?
kbay808Author Commented:
Thanks Rgonzo.  That worked great
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.