473,703 Members | 2,394 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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>ValueFromFie ld1</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 4700
do**@hsn.uk.net (George Kinnear) wrote in
news:40******** *************** ***@posting.goo gle.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>ValueFromFie ld1</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(mRI FullNameIndex), "")
AC97Replace subSubStream, """", Len(""""), "&quot;"
subStream = mStrEvent
AC97Replace subStream, "[Title]", Len("[Title]"), "Father"
If InStr(strExclud ed, "[" & CStr(lngFatherI d) & "]") <> 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.ne t (George Kinnear) wrote in
news:40******* *************** ****@posting.go ogle.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>ValueFromFie ld1</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(mRI FullNameIndex), "")
AC97Replace subSubStream, """", Len(""""), "&quot;"
subStream = mStrEvent
AC97Replace subStream, "[Title]", Len("[Title]"), "Father"
If InStr(strExclud ed, "[" & CStr(lngFatherI d) & "]") <> 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.e du
"George Kinnear" <do**@hsn.uk.ne t> wrote in message
news:40******** *************** ***@posting.goo gle.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>ValueFromFie ld1</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.spa m.cox.net> wrote in
news:pj******** *************** *********@4ax.c om:
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("So meFieldName")

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("Fie ldName")

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
7624
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 was unsuccessful in that. Can u give me the exact command for doing so? I had tired:
2
1257
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
3311
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 broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ?
5
3820
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 column for a PK). If the file were smaller I would probably just use Excel to pop in a PK and then just load into the table... Since Excel chokes on files greater than 65k lines, this won't work.
4
1984
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 email related tags and all files have same exact format. I would like to generate reports in a web page based upon the content of these XML files but not sure where to start. I know how to make an individual XML file display in browser by linking a...
2
2596
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 just a blank page in IE 6. Can anybody tell me what I should change to make IE happy? Even better, is there any kind of tutorial out there on dynamically generating tables? Many thanks,
16
2553
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I generate a random integer from 1 to N? ----------------------------------------------------------------------- function Random(x) { return Math.floor(x*Math.random()) } gives a random integer in the range from 0 to x-1 inclusive; use =AB Random(N)+1 =BB for 1 to N.
6
2710
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 parameters that I keep changing. this way it saves the pain of having to back up the output file and rename it before running the program again.
4
1729
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 way I can club them together in a presentable format for reporting purpose ? So for .g. a.xml, b.xml, c.xml and d.xml. These xmls I want to display in an html report say report.html in a 4 columns in java.
0
9244
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9004
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7853
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6585
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5922
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4679
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2439
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2058
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.