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

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,223,891
Messages
6,175,229
Members
452,621
Latest member
Laura_PinksBTHFT

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