I am trying to making a webscraping code and i have searched a lot and could not find any relevevant code. which scrap the below details from the webside.
your help in this regard will be highly appreciated.
Dim Internet_Explorer As InternetExplorer
Set Internet_Explorer = New InternetExplorer
Internet_Explorer.Visible = True
Do While Internet_Explorer.readyState <> READYSTATE_COMPLETE: Loop
MsgBox Internet_Explorer.LocationName & vbNewLine & vbNewLine & Internet_Explorer.LocationURL
For Each item In respJSON("QuickQuoteResult")("QuickQuote")
ThisWorkbook.Worksheets(1).Cells(i, "A") = item("Item name")
ThisWorkbook.Worksheets(1).Cells(i, "B") = item("item price")
ThisWorkbook.Worksheets(1).Cells(i, "C") = item("Shipping price")
Hello everyone, i've been assignt at my university to create on visual studio a personal appointment reminder visual basic. My profeccor asked me to find a code on the internet for the subject to create this project.. I searched all over the internet and i couldn't find a simple reminder code or tutorial that can help me.. Does anyone have any idea where to find such a code?
You have the wrong expectation of this forum, you need to do the work and ask specific coding questions.
Clearly define the rules for each column.
Define the rules for each aggregation.
Break the process down into smaller pieces ie. get the column headers correct then get the aggregations correct then put the data into the correct columns.
It is your problem, you cannot expect strangers to define the business rules from a bunch of data for you.
Never underestimate the power of human stupidity -
I'm old. I know stuff - JSOP
when i login 5 facebook, but i only have 1 laptop. If i use 1 web browser to login, may i have checkpoint? So this case, i open browser then change user agent, change mac address
Can you help me
This links change user agent, but only extension https://chrome.google.com/webstore/detail/user-agent-switcher-for-c/djflhoibgkdhkhhcedjiklpkjnoahfmg?hl=vi, you can see it
Thank you Richard Deeming. I decided to first tryout the Excel Code (below) on Excel.
On the .Navigate command, Microfot Edge opened the site correctly
But on the While...Wend statement the code froze or raised Run-time error 462 :
"The remote server machine does not exist or is unavailable". I re-tried many times.
Dim TestString As String
TestString = "Hello world. Are you ready for us?"
MsgBox VBA_Translate(TestString, "en", "fr")
Function VBA_Translate(strSource As String, strSourceLang As String, strDestLang As String) As String
' Adopted from: http://stackoverflow.com/questions/1...text-using-vba
' Set a reference to Microsoft Internet Controls from Tools, References in VBE [OK]
' Source: http://www.vbaexpress.com/forum/showthread.php?52248-google-translator-vba-code-stop-working
' The following code is working for me.
' I have adapted, and converted to Access VBA, some Excel VBA code suggested at https://www.mrexcel.com/board/threads/google-translate-excel-vba.1079457/
' Thanks to Dossfm0q on July 24th 2020 This seems to be executing an instance of Mozilla Firefox.
' I do have Firefox installed and it's my default browser. Not sure if this is relevant.
' While I could not get Dossfm0q's code to work, I noticed that the text in objHTTP.ResponseText DID in his code in fact contain the translated text,
' and that this occurred between the string div class="result-container" just before it and /div just after it.
' so I altered his function to strResponseText() and wrote a function GetTranslatedTextFrom(ResponseText As String) As String to obtain the translated text.
' I am sure that this is less elegant than Dossfm0q's use of objHTML.getElementsByTagName("div") ,
' but since that did not work for me, I had no choice.
'Access VBA Code'--- Public Function SiftResponseText()PublicFunction GetTranslatedTextFrom(TextToTranslate AsString, FromLangCode AsString, ToLangCode AsString) AsString'input text maximum seems to be 2048 characters' REQUIRED: Set a reference to Microsoft Internet Controls from Tools/References in VBA interface'[This Function:] Identifies the translated output text by seeking the prefix <div class="result-container"> just before it and </div> just after it.'[Called by:] ' [Calls:] strResponseText()'[Example Call:] GetTranslatedTextFrom("Hello World! Are you ready for us?","en","fr") This returns : "Bonjour le monde! Êtes-vous prêt pour nous?"'[Notes:] Here are some language codes: English en, French fr, Italian it, German de , Spanish es .' Other language codes here: https://www.labnol.org/code/19899-google-translate-languages' Created: 12/14/2020 Modifications History:OnErrorGoTo Get_Err
Dim ResponseText AsStringDim GotAnError AsBoolean, PosPrefix AsLong, PosAfterPrefix AsLong, LenPrefix AsLong, PosSuffix AsLong, lenSuffix AsLongDim Prefix AsString, Suffix AsString
GotAnError = False' Get the response text from the Google translate website by calling strResponseText()
ResponseText = strResponseText(TextToTranslate, FromLangCode, ToLangCode)
' Establish the looked-for Prefix and Suffix and their lengths
Prefix = "<div class=""result-container"">"
LenPrefix = Len(Prefix)
Suffix = "</div"' the first occurring after the Prefix
lenSuffix = Len(Suffix)
' Find the Prefix and the Suffix
PosPrefix = InStr(1, ResponseText, Prefix)
If PosPrefix = 0Then MsgBox "Failed!": GoTo PreExit
PosAfterPrefix = PosPrefix + LenPrefix
PosSuffix = InStr(PosPrefix, ResponseText, Suffix)
' Get the translated text as the function's return value
GetTranslatedTextFrom = Mid(ResponseText, PosAfterPrefix, PosSuffix - PosAfterPrefix)
'If Not GotAnError then MsgBox "Success." , vbokonly , " Sub: SiftResponseText"ExitFunction' ---------------------
GotAnError = True
MsgBox str(Err) & " " & Err.Description, vbOKOnly, "Error in Sub: [SiftResponseText]"Resume PreExit
'Resume Next 'for diagnostic purposes onlyEndFunction' ==============================================PublicFunction strResponseText(strInput AsString, FrmLng AsString, ToLng AsString) AsString'[This Function:] Inputs a text, probable maximum 2048 characters, with the From-Language and the To-Language codes,' Sends a request to https://translate.google.com, and returns a response text; and returns a response text from the website.' There is probably a limit to how much use is made of this operation without Google requiring payment' Outputs a ResponseText that can be used by GetTranslatedTextFrom() to find the translated text.'[Called by:] GetTranslatedTextFrom() ' [Calls:] ' [Example Call:] RespText = strResponseText("Hello World! Are you ready for us?","en","fr")'[Notes:]'Created: 12/14/2020 Modifications History: Adapted from GgTranslate() in https://www.mrexcel.com/board/threads/google-translate-excel-vba.1079457/ originally by Dossfm0q of July 24th 2020OnErrorGoTo Goo_Err
Dim GotAnError AsBoolean
GotAnError = FalseDim strURL AsStringDim objHTTP AsObjectDim objHTML AsObjectDim objDivs AsObject, objDiv AsObjectDim strTranslated AsString' Send query to web page
strURL = "https://translate.google.com/m?hl=" & FrmLng & _
"&sl=" & FrmLng & _
"&tl=" & ToLng & _
"&ie=UTF-8&prev=_m&q=" & strInput
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP") 'late binding
objHTTP.Open "GET", strURL, False
objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
objHTTP.send ""' Create an html documentSet objHTML = CreateObject("htmlfile")
strResponseText = objHTTP.ResponseText
EndWith' The following text was commented out by me from Dossfm0q's code as I could not get it to work' Set objDivs = objHTML.getElementsByTagName("div") 'This looks like a div-block parsing function for objHTTP' For Each objDiv In objDivs' If objDiv.className = "t0" Then' strTranslated = objDiv.innerText' If strTranslated <> "" Then GoogTranslate = strTranslated' Msgbox "GoogTranslate="; GoogTranslate 'This never happened' End If' Next objDivSet objHTML = NothingSet objHTTP = Nothing
'If Not GotAnError then MsgBox "Success." , vbokonly , " Sub: GoogTranslate"ExitFunction' ---------------------
GotAnError = True
MsgBox str(Err) & " " & Err.Description, vbOKOnly, "Error in Sub: [GoogTranslate]"Resume PreExit
I've been using the RDLC design editor in VS 2017+ for a long time, and finally decided to ask about it.
The editor allows for multiple lines, but my expressions are always one liners. I remember in the past trying to use multiple lines but never had any luck. If there a char I need to add at the end of a line to use multiple lines?
I'm beginning to use notepad now to edit this expression.
I need to write this expression to check and make sure that the values are not 0 before I run the equation, but I'm not having any luck. I'm not sure why this expression crashes on 0's when I'm checking, it looks good to me but I'm not sure how to fix it. Maybe I should flip it around. Do the IFF and format the number in the IFF statement.
This expression compares sales in 2017 against sales in 2016, and show the percent of change.
FYTD4 is 4 years back
FYTD3 is 3 years back
On some items they are 0 because they didn't exist in those years.