Bryan Carbonnell
carbonnb at sympatico.ca
Fri Feb 6 11:11:39 CST 2004
> From: "Terri Jarus" <jarus at amerinet-gpo.com> > Date: Fri, 06 Feb 2004 07:54:39 -0600 > To: <accessd-owner at databaseadvisors.com> > Subject: [AccessD] AXP - Create HTML Document > > I have a report that is created dynamically in Word, however, we now want it to be created in HTML. > > Does anyone have sample code to do something like this? > > Here is a sample (shortened version) of what we use for the Word doc - how can I change it to HTML. Or is there a better way? > > Private Sub CreateCDS_Click() > DoCmd.Save > Dim objWord As Word.Application > Dim filename As String > > Set objWord = New Word.Application > > filename = "U:\Suppliers\Reports\Contract Sales\EForm\cds.dot" > > With objWord > > On Error GoTo MsgInfo > .Visible = True > > .Documents.Add _ > Template:=filename, _ > NewTemplate:=False > > > .Selection.GoTo _ > What:=wdGoToBookmark, _ > Name:="ContractNumber" > > .Selection.TypeText _ > Text:=ContractNumber > > If HubSupplier <> "" Then > .Selection.GoTo _ > What:=wdGoToBookmark, _ > Name:="Hub" > > .Selection.TypeText _ > Text:="Hub Supplier: " & Nz([HubSupplier]) > Else > End If > > .Selection.GoTo _ > What:=wdGoToBookmark, _ > Name:="ContUpd" > > .Selection.TypeText _ > Text:=ContUpd > > .Selection.GoTo _ > What:=wdGoToBookmark, _ > Name:="InternalNum" > > .Selection.TypeText _ > Text:=Nz([VendorInternal]) > > .Selection.GoTo _ > What:=wdGoToBookmark, _ > Name:="PDU" > > .Selection.TypeText _ > Text:=Prog > > .Selection.GoTo _ > What:=wdGoToBookmark, _ > Name:="Category" > > .Selection.TypeText _ > Text:=IndexCategory > > .Selection.GoTo _ > What:=wdGoToBookmark, _ > Name:="SupplierName" > > .Selection.TypeText _ > Text:=UCase([SupplierPrintName]) > > .Selection.GoTo _ > What:=wdGoToBookmark, _ > Name:="Address1" > > .Selection.TypeText _ > Text:=SupplierAddress1 > > .Selection.GoTo _ > What:=wdGoToBookmark, _ > Name:="Address2" > > .Selection.TypeText _ > Text:=Nz([SupplierAddress2]) > > .Selection.GoTo _ > What:=wdGoToBookmark, _ > Name:="CityStateZip" > > .Selection.TypeText _ > Text:=CityStateZip > > .Selection.GoTo _ > What:=wdGoToBookmark, _ > Name:="Phone" > > .Selection.TypeText _ > Text:=Nz([SupplierPhone]) > > > .Selection.GoTo _ > What:=wdGoToBookmark, _ > Name:="Fax" > > If Nz(SupplierFax, "") = "" Then > .Selection.Expand wdWord > .Selection.Delete > Else > > .Selection.TypeText _ > Text:="FAX: " & Nz([SupplierFax]) > > End If > > .Selection.GoTo _ > What:=wdGoToBookmark, _ > Name:="TollFree" > > If Nz(SupplierTollFree, "") = "" Then > .Selection.Expand wdParagraph > .Selection.Delete > Else > > .Selection.TypeText _ > Text:="TOLL FREE: " & Nz([SupplierTollFree]) > > End If > > .Selection.GoTo _ > What:=wdGoToBookmark, _ > Name:="WebAddress" > > .Selection.TypeText _ > Text:="Website: " & Nz([VendorWeb]) > > objWord.Selection.TypeParagraph > objWord.Selection.MoveDown Unit:=wdLine > > > .Quit > > End With > > Set objWord = Nothing > > MsgInfo: > On Error Resume Next > 'MsgBox "There is a required field missing information, please recheck your CDS data. Enter any required data into the Contract Info database." > Exit Sub > End Sub > > Please advise. > > Thanks for any help. > > > Terri Jarus > Director, Contract Support Services > jarus at amerinet-gpo.com > 314-542-1902 > > > --------------------------------------------------------------------------- > This email and any files transmitted with it are confidential and > intended solely for the use of the individuals or entities to whom they > are addressed. If you have received this email in error please return > it to the sender, and erase any copies thereof. > Copyright 2004 Amerinet 1nc. > -- Bryan Carbonnell - carbonnb at sympatico.ca Unfortunately common sense isn't so common!