Results 1 to 23 of 23

I need the VBA message box should open and close automatically while macro is running

Threaded View

  1. #1
    Forum Contributor
    Join Date
    08-15-2016
    Location
    Chennai
    MS-Off Ver
    MS2013
    Posts
    159

    I need the VBA message box should open and close automatically while macro is running

    I am using the below code to receive the output from DB. The code will take the data from DB and keep in Excel sheet.
    I need the VBA message box should open and close automatically while macro is running.Please help me to solve this.


    Private Sub PIN_Click()
    Dim x As Workbook
    Set x = Workbooks.Open("C:\Test data.xlsx")
    a = WorksheetFunction.CountA(Worksheets(1).Columns(2))
    For i = 2 To a
    ssn = x.Sheets("Sheet1").Range("B" & i).Value
    ssn = "'" & ssn & "'"
    Set conn = CreateObject("ADODB.Connection")
    Set rs = CreateObject("ADODB.Recordset")
    conn.Open database, TextBox1.Value, TextBox2.Value
    Sql = "select sso.FUNC_DECRYPT_STR (password) from SSO.SSO_USER where sso_user_id =" & ssn
    rs.Open Sql, conn
    Set rs = conn.Execute(Sql)
    If Not rs.EOF Then
    Excel.Workbooks("Test data.xlsx").Worksheets("Sheet1").Range("I" & i).Value = rs.Fields(0).Value
    Else
    
    Excel.Workbooks("Test data.xlsx").Worksheets("Sheet1").Range("I" & i).Value = "Data not found"
    End If
    rs.Close
    
    Sql = "select sso.FUNC_DECRYPT_STR(ALPHA_PASSWORD)  from SSO.SSO_USER where sso_user_id =" & ssn
    rs.Open Sql, conn
    Set rs = conn.Execute(Sql)
    If Not rs.EOF Then
    Excel.Workbooks("Test data.xlsx").Worksheets("Sheet1").Range("J" & i).Value = rs.Fields(0).Value
    
    Else
    Excel.Workbooks("Test data.xlsx").Worksheets("Sheet1").Range("J" & i).Value = "Data not found"
    End If
    rs.Close
    Last edited by Prabakaran3003; 06-08-2017 at 06:40 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA message box should open and close automatically while macro is running
    By Prabakaran3003 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-08-2017, 08:58 AM
  2. [SOLVED] Issue with Open, copy, close Macro - when trying to close workbook Clipboard error
    By seanpcorbett1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-13-2016, 05:14 PM
  3. [SOLVED] Automatically open, close & saved documents
    By namialus in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-24-2014, 08:48 PM
  4. Replies: 0
    Last Post: 10-02-2013, 01:47 AM
  5. [SOLVED] Automatically open and close spreadsheets on Google drive
    By judy hess in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-22-2013, 03:35 PM
  6. [SOLVED] Open file --> have pop up message appear --> click on pop up to close it
    By debbiesh in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-23-2012, 09:28 AM
  7. Open and Close Excel / Time Running
    By tchristie33 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-08-2007, 09:13 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1