I am creating a template in Word 2007 using Visual Basic Editor. I am pulling information from an Access database. I know this is probably a stupid question, but for the life of me I can't figure out how I get my data to start on a new page and keep the formatting from the first page once a new record is encountered. I have attached a copy of my code. Any help will be greatly appreciated!!! - Public blnCancelled As Boolean
-
-
Private Sub btnCancel_Click()
-
DCAMacro.blnCancelled = True
-
Unload Me
-
End Sub
-
-
Private Sub btnGetData_Click()
-
Dim conn As New ADODB.Connection
-
Dim rs As New ADODB.Recordset
-
Dim lngConnectionState As Long
-
Dim strSQL As String
-
Dim Appellant As String
-
Dim Appellee As String
-
Dim DateMandateReleased As Date
-
Dim MandateType As String
-
-
'*****Set up the connection to the database*****
-
conn.ConnectionString = "Provider=MSDAORA; Data Source=TSD1; "
-
'removed login information
-
-
'*****Open the connecton to the database*****
-
conn.Open
-
Set rs = New ADODB.Recordset
-
-
'*****Check the state of the database*****
-
lngConnectionState = conn.State
-
'If lngConnectionState = adStateOpen Then
-
-
'*****Set the datasource*****
-
strSQL = "Select Mandate_Type, Parm1, Agency_Description, CaseNo, Appellant, Appellee, Lt_Cases, Opinion_Date, Chief_Judge, Mandate_Date " & _
-
"From CMS.V_Macro4mandate " & _
-
"Where Date_Mandate_Released = '25-April-2006' "
-
-
'*****Open the recordset*****
-
rs.Open strSQL, conn, adOpenKeyset, adLockOptimistic
-
-
'*****Get the data if not end of the record set*****
-
rs.MoveFirst
-
If Not rs.EOF Then
-
Do Until rs.EOF
-
DCAMacro.txtAppellant = rs.Fields("Appellant").Value & " "
-
DCAMacro.txtAppellee = rs.Fields("Appellee").Value & " "
-
DCAMacro.txtCaseNumber = rs.Fields("CaseNo").Value & " "
-
DCAMacro.txtLowerTrib = rs.Fields("LT_Cases").Value & " "
-
DCAMacro.txtOpinionDate = rs.Fields("Opinion_Date").Value & " "
-
-
-
'*****Determine the type of mandate*****
-
'If rs.Fields("Mandate_Type").Value = "DK09" Then
-
'DCAMacro.txtMandate_Type = "Mandate"
-
'End If
-
'
-
'If rs.Fields("Mandate_Type").Value = "MA1" Then
-
'DCAMacro.txtMandate_Type = "Agency Mandate"
-
'End If
-
'
-
'If rs.Fields("Mandate_Type").Value = "MA2" Then
-
'DCAMacro.txtMandate_Type = "Circuit Court Mandate"
-
'End If
-
'
-
'If rs.Fields("Mandate_Type").Value = "MA3" Then
-
'DCAMacro.txtMandate_Type = "Worker's Compensation Mandate"
-
'End If
-
-
'If rs.Fields("CaseNo").Value = "1D" Then
-
'DCAMacro.txtDistrict = "first district"
-
'End If
-
-
-
DCAMacro.Hide 'hide the form so the document can come up
-
Set DCAMarco = Nothing
-
-
'*****Add the generic text and properties that apply to all*****
-
-
'*****formatting for heading*****
-
Selection.ParagraphFormat.LineSpacingRule = wdLineSpaceSingle
-
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
-
Selection.Font.Size = 38
-
Selection.Font.Name = "Times New Roman"
-
Selection.Font.Bold = wdToggle
-
Selection.TypeText Text:="M A N D A T E"
-
Selection.Font.Size = 12
-
Selection.TypeParagraph
-
Selection.TypeText Text:="From"
-
Selection.TypeParagraph
-
Selection.Font.Size = 14
-
Selection.Font.AllCaps = True
-
Selection.TypeText Text:="district court of appeal of florida"
-
Selection.TypeParagraph
-
Selection.TypeText Text:="first district"
-
'Selection.TypeText Text:=txtDistrict.Value
-
Selection.Font.AllCaps = False
-
Selection.TypeParagraph
-
Selection.TypeParagraph
-
Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
-
Selection.Font.Size = 11
-
Selection.TypeText Text:="To ~(name), ~(title), ~(agency)"
-
Selection.TypeParagraph
-
Selection.TypeParagraph
-
Selection.TypeText Text:="WHEREAS, in the certain cause filed in this Court styled:"
-
Selection.TypeParagraph
-
Selection.TypeParagraph
-
Selection.Font.AllCaps = True
-
Selection.TypeText Text:=txtAppellant.Value
-
Selection.Font.AllCaps = False
-
Selection.TypeText Text:=vbTab
-
Selection.TypeText Text:=vbTab
-
Selection.TypeText Text:=vbTab
-
Selection.TypeText Text:=vbTab
-
Selection.TypeText Text:=vbTab
-
Selection.TypeText Text:="Case No : "
-
Selection.TypeText Text:=txtCaseNumber.Value
-
Selection.TypeParagraph
-
Selection.TypeParagraph
-
Selection.TypeParagraph
-
Selection.TypeText Text:="v."
-
Selection.TypeText Text:=vbTab
-
Selection.TypeText Text:=vbTab
-
Selection.TypeText Text:=vbTab
-
Selection.TypeText Text:=vbTab
-
Selection.TypeText Text:=vbTab
-
Selection.TypeText Text:=vbTab
-
Selection.TypeText Text:=vbTab
-
Selection.TypeText Text:="Lower Tribunal Case No : "
-
Selection.TypeText Text:=txtLowerTrib.Value
-
Selection.TypeParagraph
-
Selection.TypeParagraph
-
Selection.TypeParagraph
-
Selection.Font.AllCaps = True
-
Selection.TypeText Text:=txtAppellee.Value
-
Selection.Font.AllCaps = False
-
Selection.TypeParagraph
-
Selection.TypeParagraph
-
Selection.TypeParagraph
-
Selection.TypeText Text:="The attached opinion was issued on "
-
Selection.TypeText Text:=rs.Fields("Opinion_Date").Value & " "
-
Selection.TypeParagraph
-
Selection.TypeText Text:="YOU ARE HEREBY COMMANDED that further proceedings, if required, be had in accordance"
-
Selection.TypeParagraph
-
Selection.TypeText Text:="with said opinion, the rules of Court, and the laws of the State of Florida."
-
Selection.TypeParagraph
-
Selection.SelectCurrentTabs
-
Selection.Paragraphs.TabIndent (1)
-
Selection.TypeText Text:="WITNESS the Honorable "
-
Selection.TypeText Text:=rs.Fields("Chief_Judge").Value & " "
-
Selection.TypeParagraph
-
Selection.SelectCurrentTabs
-
Selection.Paragraphs.TabIndent (1)
-
Selection.TypeText Text:="of the District Court of Appeal of Florida, First District"
-
'Selection.TypeText Text:=txtDistrict.Value
-
Selection.TypeText Text:=","
-
Selection.TypeParagraph
-
Selection.SelectCurrentTabs
-
Selection.Paragraphs.TabIndent (1)
-
Selection.TypeText Text:="and the Seal of said Court done at Tallahassee, Florida,"
-
'Selection.TypeText Text:=txtCity.Text
-
Selection.TypeParagraph
-
Selection.SelectCurrentTabs
-
Selection.Paragraphs.TabIndent (1)
-
Selection.TypeText Text:="on this "
-
Selection.TypeText Text:=rs.Fields("Mandate_Date").Value & " "
-
Selection.ClearParagraphAllFormatting
-
-
rs.MoveNext
-
-
Loop
-
End If
-
-
MsgBox "Done.", vbOKOnly
-
-
' rs.Close
-
' conn.Close
-
' Set conn = Nothing
-
' Set rs = Nothing
-
-
End Sub
2 2616
hello dear
plz help me soon yaar
1.> How can i create a macro in msword using visul basic editor and how it saves after saving how this macro call in visual basic6
2.> give me full info for this code its very urgent for my educational project.
plz help me soon
hello dear
plz help me soon yaar
1.> How can i create a macro in msword using visul basic editor and how it saves after saving how this macro call in visual basic6
2.> give me full info for this code its very urgent for my educational project.
plz help me soon
replay me on
amitkumar19@gma il.com
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Clifford W. Racz |
last post by:
Has anyone solved the issue of translating lists in Word 2003 (WordML)
into xHTML? I have been trying to get the nested table code for my XSLT
to work for a while now, with no way to get the collection that I need.
To begin, I am using xsltproc that conmes with Cygwin as my processor.
I have no particular affinity to this processor except...
|
by: typingcat |
last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so
on. I've tried many PHP IDEs today, but almost non of them supported
Unicode (UTF-8) file.
I've found that the only Unicode support IDEs are DreamWeaver 8 and
Zend PHP Studio.
DreamWeaver provides full support for Unicode. However, DreamWeaver is
a web editor rather...
|
by: Mike MacSween |
last post by:
tblCourses one to many to tblEvents.
A course may have an intro workshop (a type of event), a mid course
workshop, a final exam. Or any combination. Or something different in the
future.
At the moment the printed output is usually going to Word. It's turning into
an unholy mess, because I'm having to prepare umpteen different Word...
|
by: pontifikas |
last post by:
I'm having hard time finding documentation for Word.Document or
Word.Application classes and there is something I need to do.
I want to know how to read from a word file and how to maintain
formatting(Bolds, itallics etc).
Also can I write , say bold, characters in a word file?How?
Thanks in advance :)
|
by: enak |
last post by:
I have found some code that shows how to convert an html
form to Word. The message said to simply put the following
in the Page_load:
Response.ContentType = "application/ms-word"
Response.AddHeader("content-disposition", "inline;
filename=BP_CaseStatus.doc")
Now all I should have to do is create the page just like I
would if I were...
| |
by: Keith Butler |
last post by:
H
Very new to CHM file. My question is can I create CHM file from a word document (or any other document)? Appreciate links to any good article on creation of CH
Thank
Keit
|
by: Dixie |
last post by:
Is there a way to shell to Microsoft Word from Access and load a specific
template - using VBA?
dixie
|
by: giladp1 |
last post by:
I found Albert Kallal's great "Super easy Word Merge" code in his site
at:
http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html
Thanks Albert so much for sharing this.
I am looking for any comments about the use of the docmd.transfertext
method instead of the code Albert used for creating the text file.
Also, perhaps some...
|
by: =?Utf-8?B?QmVuamFtaW5vNQ==?= |
last post by:
Apologies if this is the wrong forum. I normally post in the Word Programming
group, but this seemed like more of a VB.Net question.
I'm moving code from VBA over to Visual Studio Express 2005 (Visual Basic)
while still learning about VB.Net. (Not a good combination, I know.)
One problem I'm seeing is that certain lines of code that work...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
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. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
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...
|
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...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
| |
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...
| |