PDA

View Full Version : MSG Box



kshahzad85
12-13-2023, 07:12 AM
Sub InputIdAndPassword() Dim userId As String Dim password As String ' Prompt for User ID userId = InputBox("Enter User ID:", "Login") ' Prompt for Password password = InputBox("Enter Password:", "Login") ' Check if both ID and Password are provided If userId <> "" And password <> "" Then ' Call a function or perform actions based on the provided ID and Password ' For example, you might use them to log in or authenticate. ' Placeholder for demonstration purposes MsgBox "Login successful for User ID: " & userId Else MsgBox "Login canceled or incomplete.", vbExclamation End IfEnd Sub

Paul_Hossler
12-13-2023, 07:59 AM
My mind reading helmet needs new batteries so I can't tell what the issue is. Please elaborate

Also, you can attach files here instead of Dropbox, or post code in the message body between CODE tags using the [#] icon

kshahzad85
12-13-2023, 10:43 AM
https://www.dropbox.com/scl/fi/eu40sujgru8rga1x3wlmw/Sub-OpenLoginForm.paper?rlkey=eomz4f9apnegds3240hxy6m7o&dl=0

June7
12-13-2023, 05:50 PM
What is your question? Describe the issue - code, error message, debugging attempts.

Many will not download files from external site, best to attach file to post.

Aussiebear
12-13-2023, 10:48 PM
This is the code that kshahzah85 is referring to in the dropbox file. How it relates to the "msg box" is anybody's guess.


Sub SendValuesToJSPPage()
Dim ie As Object
' Create a new instance of Internet Explorer
Set ie = CreateObject("InternetExplorer.Application")
' Navigate to the desired webpage
ie.Navigate "https://www.example.com/login.jsp"
' Make Internet Explorer visible
ie.Visible = True
' Wait until the IE object is in a ready state
Do While ie.readyState <> 4 ' READYSTATE_COMPLETE
DoEvents
Loop
' Check if the current URL contains "login.jsp"
If InStr(ie.LocationURL, "login.jsp") > 0 Then
' If you are on the login page, fill in the form fields with your credentials
ie.document.getElementById("username").Value = "your_username"
ie.document.getElementById("password").Value = "your_password"
' Find the submit button based on its value attribute
Dim submitButton As Object
Set submitButton = ie.document.querySelector("input[type='submit'][value='sign in']")
' Click the submit button
If Not submitButton Is Nothing Then
submitButton.Click
Else
MsgBox "Submit button not found!"
End If
' Wait for the page to load after submitting the form
Do While ie.readyState <> 4 ' READYSTATE_COMPLETE
DoEvents
Loop
' Now you are likely on the post-login page
' Add additional code as needed
' Example: Retrieve data from the post-login page
Dim postLoginPageData As String
postLoginPageData = ie.document.body.innerHTML
Debug.Print postLoginPageData
End If
' Clean up
Set ie = Nothing
End Sub


I'm also somewhat dubious about the section of code, after the second loop.

Paul_Hossler
12-14-2023, 11:29 AM
What is your question? Describe the issue - code, error message, debugging attempts.

Many will not download files from external site, best to attach file to post.

I think we need to be patient with an Excel / forum newbie, esp one who doesn't appear to be a natural english speaker

Paul_Hossler
12-14-2023, 11:31 AM
https://www.dropbox.com/scl/fi/eu40sujgru8rga1x3wlmw/Sub-OpenLoginForm.paper?rlkey=eomz4f9apnegds3240hxy6m7o&dl=0

Second time asking -- please just attach a file to you post

Also, you MUST say what the problem / issue / question is

Something like

"I click Close and I get an error message on the marked line"

or

"It runs to the end, but the file is not deleted"