Hi liebes Forum !
Ich habe ein Problem mit der InStr Funktion. Ich suche mit InStr das Wort "Contactnumber" in einer sehr langen String variable.
Die String Variable habe ich in eine .txt Datei gespeichert und im Abschnitt:
IS24.expose = {
angularDebugInfoEnabled: false,
version: "7072",
id: 101482038,
viaInformation: {
isQualifiedForRealtorBoxes: false
},
commercializationType: 'RENT',
onTopProduct: '',
realEstateType: "APARTMENT_RENT",
world: "wohnen",
preview: false,
userLoggedIn: false,
realtorApiUrl: "\/anbieter\/api\/branchenbuch\/v1.2\/realtor\/001.479412?clientId=expose",
realtorExtendedApiUrl: "\/anbieter\/api\/branchenbuch\/v1.0\/realtorextended\/001.479412?clientId=expose",
returnUrl: "\/expose\/101482038",
galleryData: {"floorPlanAvailable":true,"virtualTours":[],"panoramaView":{"url":"","available":false},"imageCount":5},
shortlistEntry: {"alreadyInspected":false,"onShortlist":false,"disabled":false},
screen9Url: "",
ssoLoginUrl: "https://sso.immobilienscout24.de/sso/authenticate?appName=expose&sso_return=https://www.immobilienscout24.de/expose/101482038",
nonceToken: "c791b0a1dd9dd913ff67d",
isDeactivated: false,
isDesktop: true,
isHistoricalListing: false,
isMobile: false,
showContactForm: true,
contactData: {"phoneNumbers":{"phoneNumber":{"contactNumber":"066666666"}},"contactPerson":{"salutationAndTitle":"xxx","firstName":"xxx","lastName":"xxx"},"contactButton":{"hasEmail":true,"disabled":false},"realtorInformation":{"companyName":"xxxAG","realtorLogo":"https://pic.ixxx","realtorHomepage":"http://www.xxx.de","privateOffer":false}},
availableServicesData: {"squareMeters":64.23,"zipCode":"xxxx","isGasHeating":false},
features: {
googleMapPlacesTextSearch: false,
showIdentificationForm: false,
virtualTourEnabled: true,
visitorCountEnabled: false,
applicationPackageContactPromo: true
}
};
finde ich über die manuelle Suche (Strg+f) in der Textdatei auch das gesuchte Wort.
Die txt Datei wurde mit
'Datei erstellen
'---------------------------------------------------
Open "d:\HTMLfile.txt" For Output As #1
Print #1, HTML
Close #1
'---------------------------------------------------
erstellt.
Der VBA Code:
'Checken ob Telefonnummer angegeben
'---------------------------------------------------
Dim Telefonnummervorhanden As Boolean
Dim Telefonnummerpos As Integer
Telefonnummervorhanden = False
Telefonnummerpos = InStr(HTML, "contactNumber")
'---------------------------------------------------
MsgBox ("Telefonnummerpos " & Telefonnummerpos)
Gibt mir aber immer als Telefonpos "0" aus.
Selbiges gilt für "regio". Der VBA Code:
''Stadt raussuchen
''---------------------------------------------------
'Dim StadtAnfangPosition As Integer
'Dim StadtEndePosition As Integer
'Dim Stadt As String
'Dim Stadt_Ende, Stadt_Beginn As String
'
'Stadt_Beginn = "regio2"
'Stadt_Ende = "}"
'
'StadtAnfangPosition = InStr(HTML, Stadt_Beginn) ' <--- liefer bei der suche noch "obj_regio" 0
'MsgBox ("Anfangpos der Stadt: " & StadtAnfangPosition)
'StadtEndePosition = InStr(StadtAnfangPosition + 3, HTML, Stadt_Ende)
'MsgBox ("Endpos der Stadt: " & StadtEndePosition)
'
'Stadt = Mid(HTML, StadtAnfangPosition + Len(Stadt_Beginn), StadtEndePosition - StadtAnfangPosition - Len(Stadt_Beginn))
'MsgBox ("Die Stadt heißt: " & Stadt)
''---------------------------------------------------
findet in dem String nicht die passende Zeichenfolge obwohl sie im Abschnitt:
(function () {
var keyValues = {"obj_regio1":"Nordrhein_Westfalen","obj_serviceCharge":"130","obj_heatingType":"central_heating","obj_telekomTvOffer":"ONE_YEAR_FREE","obj_cId":"479412","obj_newlyConst":"n","obj_balcony":"y","obj_picture":"https://picturexxxx","obj_electricityBasePrice":"90.76","obj_picturecount":"5","obj_pricetrend":"4.72","obj_telekomUploadSpeed":"40 MBit/s","obj_telekomTrackingGroup":"telekom_layer_magenta_l","obj_telekomInternetTechnology":"über VDSL","obj_yearConstructed":"1951","abtest":"is24_abtest_expo976_default","obj_telekomInternetType":"REGULAR","obj_electricityKwhPrice":"0.1845","ga_cd_test_cxp_ads":"DEFAULT","obj_dfpZipCodeCluster":"EON_Sommergas,EON_Strom_Neu,OBI_Kueche_Projektmaerkte,OBI_TKK-Maerkte,RWE_Solar_VAG,RWE_Umziehen_Ausschluss,RWE_Waerme_VAG,Telekom_Aktionspreis_A","obj_scoutId":"xxx","obj_firingTypes":"natural_gas_light","obj_hasKitchen":"n","obj_ExclusiveExpose":"false","obj_telekomInternetProductName":"MagentaZuhause L","geo_bln":"Nordrhein_Westfalen","obj_cellar":"n","obj_yearConstructedRange":"2","obj_baseRent":"505.01","obj_houseNumber":"99","obj_energyType":"energy_consumption","obj_livingSpace":"64.23","geo_krs":"Düsseldorf","obj_zipCode":"40477","obj_condition":"well_kept","obj_interiorQual":"no_information","obj_petsAllowed":"negotiable","ga_cd_cxp_historicallisting":"false","obj_telekomDownloadSpeed":"100 MBit/s","obj_street":"Tußmannstr.","obj_lift":"n","obj_depositLink":"n","obj_baseRentRange":"4","obj_telekomInternetUrlMobile":"https://padlock.link/ioml","obj_telekomInternetUrl":"https://padlock.link/ml","obj_streetPlain":"Tußmannstr.","obj_typeOfFlat":"apartment","geo_plz":"40477","obj_noRooms":"3","obj_assistedLiving":"n","obj_thermalChar":"108","obj_groupnumber":"47","obj_ityp":"0,active","obj_telekomHdTelephone":"true","geo_land":"Deutschland","ga_cd_via":"standard","obj_telekomInternet":"100 MBit/s","obj_immotype":"wohnung_miete","ga_cd_test_cxp_expose_contact_flow":"DEFAULT","obj_floor":"4","obj_telekomInternetServices":"web,email,bank,music,dl-ul,game,sd,mltstr,hd,fast-ul-dl","obj_telekomInternetProductAvailable":"true","obj_cwId":"001.479412","ga_cd_test_cxp_expose":"DEFAULT","ga_cd_application_requirements":"profile0solvencycheck0","obj_numberOfFloors":"4","obj_noRoomsRange":"3","obj_garden":"n","obj_barrierFree":"n","obj_regio3":"Pempelfort","obj_objectnumber":"47_020","obj_livingSpaceRange":"3","obj_regio2":"Düsseldorf"};
Des HTML codes zu finden ist.
Kann mir da jemand weiter helfen ?
|