Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Word Macro, Visual BAsic


  • Please log in to reply

#1
arul20

arul20

    New Member

  • Member
  • Pip
  • 4 posts
Hello,

How can I include a table from a website (it is dynamic) in a Word doc using macro?

I use Visual Basic. I know that 'IncludePicture' can be used for dynamically getting pictures from websites, but this is a table and i'm lost ...

Usage: When the macro is run, a report will be created with the latest table.

Thanks
  • 0

Advertisements


#2
stu_design

stu_design

    Member

  • Member
  • PipPipPip
  • 217 posts
i dont know about doing it in word but heres code to do it in excel

Sub Macro9()

    With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;http://aa.usno.navy.mil/cgi-bin/aa_rstablew.pl", Destination:=Range("C8" _
        ))
        .Name = "aa_rstablew.pl_1"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlAllTables
        .WebFormatting = xlWebFormattingNone
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .refresh BackgroundQuery:=False
    End With
End Sub

i will look intio it tho

maybe if you could use excel to create reports maybe be good for u

Stu Design


PS WHERE THERE IS A WILL THERE IS A WAY
  • 0

#3
stu_design

stu_design

    Member

  • Member
  • PipPipPip
  • 217 posts
you can go in excel

go data, import external data, new web query

go to site and viola

and if u want in code jus start recording just before u import the data

tada

Stu Design
  • 0

#4
arul20

arul20

    New Member

  • Topic Starter
  • Member
  • Pip
  • 4 posts
Hey thanks Stu ..
I'll try it out and post back on Monday ..
  • 0

#5
arul20

arul20

    New Member

  • Topic Starter
  • Member
  • Pip
  • 4 posts
Ok I tried it out ..

It did not work ..

Xdomain.some.com requires a frame-capable browser with JavaScript enabled. You can obtain such a browser from the list below or enable the JavaScript option if you haven't done so.


I was using Internet Explorer. I tried setting all activeX, JavaScript options but it did not work.

Also, the website requires a password to enter. I have a username and password already, but how do I enter that into Excel's webquery?

Thanks.
  • 0

#6
stu_design

stu_design

    Member

  • Member
  • PipPipPip
  • 217 posts
ok to get this done

you have to recors a macro

so u go tools, macro , and record new macro

go data, import external data, new web query

go to site and input passwords, ids etc

now the table should be in the excel

***********

now go into code

and see this?

SavePassword = False

change it to true and try it out

Stu Design

PS I AM LOOKING INTO THIS
(dont worry - ill help oout)
  • 0

#7
arul20

arul20

    New Member

  • Topic Starter
  • Member
  • Pip
  • 4 posts
Hey thanks man ..

I'll try it out tomr and let u know ..

Arul
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP