473,386 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Can VBA be used to generate HTML docs?

I am working on a project which relies on being able to generate
several hundred simple HTML documents, based on records from an Access
database.

I'm new to VBA, so I'm not sure if it can do what I want - to insert
values from the database into HTML (like <p>ValueFromField1</p>) and
save the resulting code as .htm files.

All I need to know is if it is vaguely possible, or if I should try
another method (suggestions welcome!).

Thanks in advance :)
Nov 12 '05 #1
4 4687
do**@hsn.uk.net (George Kinnear) wrote in
news:40**************************@posting.google.c om:
I am working on a project which relies on being able to generate
several hundred simple HTML documents, based on records from an Access
database.

I'm new to VBA, so I'm not sure if it can do what I want - to insert
values from the database into HTML (like <p>ValueFromField1</p>) and
save the resulting code as .htm files.

All I need to know is if it is vaguely possible, or if I should try
another method (suggestions welcome!).

Thanks in advance :)


Yes, it's entirely possible.

a snippet:

..Seek "=", lngFatherId
If Not .NoMatch Then
subSubStream = Nz(.Collect(mRIFullNameIndex), "")
AC97Replace subSubStream, """", Len(""""), "&quot;"
subStream = mStrEvent
AC97Replace subStream, "[Title]", Len("[Title]"), "Father"
If InStr(strExcluded, "[" & CStr(lngFatherId) & "]") <> 0 Then
AC97Replace subStream, "[Event]", Len("[Event]"), subSubStream
Else
AC97Replace subStream, "[Event]", Len("[Event]"), _
"<a href=f" & lngFatherId & ".htm>" & subSubStream & "</a>"
End If
If InStr(Stream, subStream) = 0 Then Stream = Stream & vbCrLf &
subStream
End If
--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #2
On 5 Nov 2003 11:53:30 GMT, Lyle Fairfield
<Mi************@Invalid.Com> wrote:

Lyle, what is that .Collect method on a DAO recordset?
It doesn't seem to be documented anywhere.

-Tom.

do**@hsn.uk.net (George Kinnear) wrote in
news:40**************************@posting.google. com:
I am working on a project which relies on being able to generate
several hundred simple HTML documents, based on records from an Access
database.

I'm new to VBA, so I'm not sure if it can do what I want - to insert
values from the database into HTML (like <p>ValueFromField1</p>) and
save the resulting code as .htm files.

All I need to know is if it is vaguely possible, or if I should try
another method (suggestions welcome!).

Thanks in advance :)


Yes, it's entirely possible.

a snippet:

.Seek "=", lngFatherId
If Not .NoMatch Then
subSubStream = Nz(.Collect(mRIFullNameIndex), "")
AC97Replace subSubStream, """", Len(""""), "&quot;"
subStream = mStrEvent
AC97Replace subStream, "[Title]", Len("[Title]"), "Father"
If InStr(strExcluded, "[" & CStr(lngFatherId) & "]") <> 0 Then
AC97Replace subStream, "[Event]", Len("[Event]"), subSubStream
Else
AC97Replace subStream, "[Event]", Len("[Event]"), _
"<a href=f" & lngFatherId & ".htm>" & subSubStream & "</a>"
End If
If InStr(Stream, subStream) = 0 Then Stream = Stream & vbCrLf &
subStream
End If


Nov 12 '05 #3
It depends on whether you are looking to do something quick and dirty or
something long term.

HTML is extremely quick and dirty, the only thing you would have to do is
establish a naming convention and default directory to point your hyperlinks
to (I'm presuming you are going to generate an index file of some sort as
well).

If you have the time, XML (at least in my opinion) is a better long term
solution. Defines your schema(s) and whatnot and then autogenerate based
off of those.
*You don't have to get too crazy with a schema/style, but you can still
output just the raw XML tags just as easily as HTML.

Good luck,

--
Travis Cornwell
Computer Science Coop
REM Services Inc.
tw******@ncsu.edu
"George Kinnear" <do**@hsn.uk.net> wrote in message
news:40**************************@posting.google.c om...
I am working on a project which relies on being able to generate
several hundred simple HTML documents, based on records from an Access
database.

I'm new to VBA, so I'm not sure if it can do what I want - to insert
values from the database into HTML (like <p>ValueFromField1</p>) and
save the resulting code as .htm files.

All I need to know is if it is vaguely possible, or if I should try
another method (suggestions welcome!).

Thanks in advance :)

Nov 12 '05 #4
Tom van Stiphout <to*****@no.spam.cox.net> wrote in
news:pj********************************@4ax.com:
On 5 Nov 2003 11:53:30 GMT, Lyle Fairfield
<Mi************@Invalid.Com> wrote:

Lyle, what is that .Collect method on a DAO recordset?
It doesn't seem to be documented anywhere.

-Tom.


Collect returns field values directly.
One can use a numerical index or the field name.
rst.Collect(5)
rst.Collect("SomeFieldName")

It seems to be the second fastest way of getting field values, after
declaration of a field, and the setting of that field to a field in the
recordset as:

Dim fld as DAO (or ADO) field
SET fld = rst.Fields(3) or rst.Fields("FieldName")

then

do something with fld.value. (Dimitri Furman pointed out that this was
faster when I suggested Collect might be fastest and after I wrote that
code.) I believe it's quite a bit faster than bang or dot using the default
property (value) or the recordset using the default field property.

Why isn't it documented? I don't know. I've been using it for years with no
problems. And I still use it for single retrievals of data. But when I'm
doing a lot of processing, say looping through a recordset 40 times, I use
the Dimitri method, that is I set the field object variables outside the
loop. This can have a dramatic effect on speed.

I'm wearing new glasses ... this may make no sense at all.
--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Prakash | last post by:
Hi, I want to generate the JDK API using Javadoc. I have installed java 1.4.2 in WINDOWS. Since i don't have frequent access to the Net, i want to generate the Java API Help using javadoc.But I...
2
by: Jorntk | last post by:
how to generate test fields base on the number selected in a drop down option menu? -- Thanks and Regards Jorn
1
by: Antony Paul | last post by:
Hi all, What are the characters used for pattern matching with PostgreSQL 7.3. I know it is using % and _ . Any other characters ?. rgds Atnony Paul ---------------------------(end of...
5
by: Hunter Hillegas | last post by:
I have a CSV file with 400,000 lines of email mailing list information that I need to migrate to a new PostgreSQL database. Each line has all the info I need except a PK (I usually use an int4...
4
by: sysxperts | last post by:
Hi, I have a mail server that generates archives in a directory for every message sent or received and each archive has an associated XML file with <sender>, <receiver>, <subject> and other...
2
by: aric.bills | last post by:
Hello all, I'm a novice Javascript programmer, and I'm having browser compatability issues regarding dynamic generation of tables. The following content generates "hello" in Firefox 1.5, but...
16
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I generate a random integer from 1 to N?...
6
by: Freddy | last post by:
Hi all, I use a C program to generate lots of data while changing many parameters sometimes. However, I am trying to find a way to let C generate the output file names dependent on a few...
4
by: Nick | last post by:
I have a critical requirement where I need to club together 4 xml files and display them in an sibngle HTML report. The xmls are generated by Java application by a normal file I/O. Is there a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.