table with wrong selenium vba formatting

cgpa

New Member
Joined
Jan 23, 2023
Messages
11
Office Version
  1. 2007
Platform
  1. Windows
hello
I have a code that copies the table but with the wrong formatting, how can I copy the table with the original formatting? I tried to put ".NumberFormat = "@" "but it gives an error

Dim driver As Selenium.ChromeDriver
Dim table As WebElement
Dim destSheet As Worksheet



Set destSheet = ActiveSheet

Set driver = New Selenium.ChromeDriver
With driver
.Start
.Get "https://www2.bmf.com.br/pages/porta...regao-ptBR.asp?Data=02/01/2023&Mercadoria=DOL"
End With




Set table = driver.FindElementById("MercadoFut0").FindElementByTag("table")
table.AsTable.ToExcel destSheet.range("A2")

Set table = driver.FindElementById("MercadoFut1").FindElementByTag("table")
table.AsTable.ToExcel destSheet.range("B2").NumberFormat = "@"

Set table = driver.FindElementById("MercadoFut2").FindElementByTag("table")
table.AsTable.ToExcel destSheet.range("G2").NumberFormat = "@"
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,216,743
Messages
6,132,464
Members
449,729
Latest member
davelevnt

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