Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
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