help of VBA code Editing

Jagat Pavasia

Active Member
Joined
Mar 9, 2015
Messages
413
Office Version
  1. 2021
Platform
  1. Windows
dear sir,
I have VBA code Below :

VBA Code:
Sub Send_Image_To_WhatsApp()



Dim whatsapp_number As String





Dim sh As Worksheet

Set sh = ThisWorkbook.Sheets("bill")



Dim i As Integer



For i = 42 To sh.Range("f" & Application.Rows.Count).End(xlUp).Row



    If sh.Range("g" & i).Value <> "No" Then  'check skip

 

        whatsapp_number = sh.Range("f" & i).Value

     

        ThisWorkbook.FollowHyperlink "https://web.whatsapp.com/send?phone=%2B" & whatsapp_number & "&text=&app_absent=1&send=1"

   

            Application.Wait (Now() + TimeValue("00:00:08"))

         

            sh.Range("a1:h40").CopyPicture , xlBitmap

            Application.Wait (Now() + TimeValue("00:00:08"))

            VBA.SendKeys ("^v")

            Application.Wait (Now() + TimeValue("00:00:01"))

            VBA.SendKeys "~", True

         

            Application.Wait (Now() + TimeValue("00:00:01"))

         

 

    End If

Next i





MsgBox "OK", vbInformation



End Sub

It is working as it should, but I want that auto close tab of google chrome browser after it finished.
Not Fully close Browser, but only close web.whatsapp tab.

please help me to edit this


EDIT:
I also want that Start Minimized google Chrome Browser and Close tab After it done work
 
Last edited by a moderator:
try like this

VBA Code:
Sub Send_Image_To_WhatsApp()

Dim whatsapp_number As String
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("bill")

    Dim i As Integer
        For i = 42 To sh.Range("f" & Application.Rows.Count).End(xlUp).Row
            If sh.Range("g" & i).Value <> "No" Then  'check skip
                whatsapp_number = sh.Range("f" & i).Value
        
                ThisWorkbook.FollowHyperlink "https://web.whatsapp.com/send?phone=%2B" & whatsapp_number & "&text=&app_absent=1&send=1"
        
                    Application.Wait (Now() + TimeValue("00:00:08"))
                        sh.Range("a1:h40").CopyPicture , xlBitmap
                    Application.Wait (Now() + TimeValue("00:00:08"))
                        VBA.SendKeys ("^v")
                    Application.Wait (Now() + TimeValue("00:00:01"))
                        VBA.SendKeys "~", True
                    Application.Wait (Now() + TimeValue("00:00:03"))
            End If
        Next i

        SendKeys "%{F4}"
        
MsgBox "OK", vbInformation

End Sub
 
Upvote 0

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