Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
  • Avatar do usuário
  • Avatar do usuário
Avatar do usuário
Por fcarlosc2018
Posts Avatar
#59145
Boa-tarde galera

Qual o método via código VBA para "Salvar como" página html em uma determina pasta no PC.
A parte de abrir a página já funciona, porém a outra que é salvar como, até salva mas quando eu abro o arquivo está em branco.
Estou usando esse código:
Código: Selecionar todos
Sub AbrirPagina()

On Error GoTo sair

ActiveWorkbook.FollowHyperlink "http://www.google.com.br", NewWindow:=True

ActiveWorkbook.SaveAs _
Filename:="C:\Teste\Google.html", _
FileFormat:=xlHtml

Exit Sub
sair: MsgBox Err.Description

End Sub
Att,
Francisco
Por Raygsson
Posts
#59151
Se voce quiser apenas baixar o HTML da página não precisa nem abrir o navegador, pode usar este código:
Código: Selecionar todos

Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" _
(ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, _
ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

Sub Download()
Dim URL As String, LocalSalvar As String

URL = "http://www.google.com.br"
LocalSalvar = ThisWorkbook.Path & "\teste.html"
Call URLDownloadToFile(0, URL, LocalSalvar, 0, 0)

End Sub

long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord