S
Shauna Koppang
Hi,
The following macro works perfectly with only one thing
that needs to be changed and I am not sure how to do it.
It has to do with the Address in Outlook. If I have an
address that has been entered into Outlook on multi
lines, when it comes into Word using this or even the
AddressLayout AutoText entry, it puts in a hard return in
the address, not a line break which it does for a single
line address. Is there a way in this macro to have it
check the address that is brought in and change any hard
returns it finds into line breaks? The reason is I have
another macro that picks up the address block as a single
item (no hard returns) then places it on an envelope.
This is the last thing to finish on this project and I
need to finish it today if possible. THANKS SO MUCH!!!
Shauna
Private Sub CommandButton1_Click()
Setup.Hide
'Unload Setup
Application.StatusBar = "Word is customizing the
letter with the information you have provided"
Application.ScreenUpdating = False
Dim MyName As String
Dim MyLawyer As String
Dim strMyLocal As String
Dim strMyInitials As String
strMyName = YourName.Value
strMyLawyer = Lawyer.Value
strMyInitials = System.PrivateProfileString
(FileName:="h:\blginfo.ini", Section:=strMyName,
Key:="Initials")
strMyLawyerDirectPhone = System.PrivateProfileString
(FileName:="h:\blginfo.ini", Section:=strMyLawyer,
Key:="DirectPhone")
strMyLawyerEmail = System.PrivateProfileString
(FileName:="h:\blginfo.ini", Section:=strMyLawyer,
Key:="Email")
strMyLawyerDirectFax = System.PrivateProfileString
(FileName:="h:\blginfo.ini", Section:=strMyLawyer,
Key:="DirectFax")
strMyLawyerInitials = System.PrivateProfileString
(FileName:="h:\blginfo.ini", Section:=strMyLawyer,
Key:="Initials")
strMyLawyerName = System.PrivateProfileString
(FileName:="h:\blginfo.ini", Section:=strMyLawyer,
Key:="Name")
ActiveDocument.Bookmarks("DirectPhone").Select
Selection.TypeText strMyLawyerDirectPhone
ActiveDocument.Bookmarks("SecretaryInitials").Select
Selection.TypeText strMyInitials
ActiveDocument.Bookmarks("Email").Select
Selection.TypeText strMyLawyerEmail
ActiveDocument.Bookmarks("DirectFax").Select
Selection.TypeText strMyLawyerDirectFax
ActiveDocument.Bookmarks("Name").Select
Selection.TypeText strMyLawyerName
ActiveDocument.Bookmarks("Name2").Select
Selection.TypeText strMyLawyerName
ActiveDocument.Bookmarks("LawyerInitials").Select
Selection.TypeText strMyLawyerInitials
Unload Setup
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton2_Click()
End
End Sub
Private Sub UserForm_Initialize()
Lawyer.AddItem "RLB"
Lawyer.AddItem "DLS"
Lawyer.AddItem "BJF"
YourName.AddItem "Kellyr"
YourName.AddItem "Fazals"
End Sub
The following macro works perfectly with only one thing
that needs to be changed and I am not sure how to do it.
It has to do with the Address in Outlook. If I have an
address that has been entered into Outlook on multi
lines, when it comes into Word using this or even the
AddressLayout AutoText entry, it puts in a hard return in
the address, not a line break which it does for a single
line address. Is there a way in this macro to have it
check the address that is brought in and change any hard
returns it finds into line breaks? The reason is I have
another macro that picks up the address block as a single
item (no hard returns) then places it on an envelope.
This is the last thing to finish on this project and I
need to finish it today if possible. THANKS SO MUCH!!!
Shauna
Private Sub CommandButton1_Click()
Setup.Hide
'Unload Setup
Application.StatusBar = "Word is customizing the
letter with the information you have provided"
Application.ScreenUpdating = False
Dim MyName As String
Dim MyLawyer As String
Dim strMyLocal As String
Dim strMyInitials As String
strMyName = YourName.Value
strMyLawyer = Lawyer.Value
strMyInitials = System.PrivateProfileString
(FileName:="h:\blginfo.ini", Section:=strMyName,
Key:="Initials")
strMyLawyerDirectPhone = System.PrivateProfileString
(FileName:="h:\blginfo.ini", Section:=strMyLawyer,
Key:="DirectPhone")
strMyLawyerEmail = System.PrivateProfileString
(FileName:="h:\blginfo.ini", Section:=strMyLawyer,
Key:="Email")
strMyLawyerDirectFax = System.PrivateProfileString
(FileName:="h:\blginfo.ini", Section:=strMyLawyer,
Key:="DirectFax")
strMyLawyerInitials = System.PrivateProfileString
(FileName:="h:\blginfo.ini", Section:=strMyLawyer,
Key:="Initials")
strMyLawyerName = System.PrivateProfileString
(FileName:="h:\blginfo.ini", Section:=strMyLawyer,
Key:="Name")
ActiveDocument.Bookmarks("DirectPhone").Select
Selection.TypeText strMyLawyerDirectPhone
ActiveDocument.Bookmarks("SecretaryInitials").Select
Selection.TypeText strMyInitials
ActiveDocument.Bookmarks("Email").Select
Selection.TypeText strMyLawyerEmail
ActiveDocument.Bookmarks("DirectFax").Select
Selection.TypeText strMyLawyerDirectFax
ActiveDocument.Bookmarks("Name").Select
Selection.TypeText strMyLawyerName
ActiveDocument.Bookmarks("Name2").Select
Selection.TypeText strMyLawyerName
ActiveDocument.Bookmarks("LawyerInitials").Select
Selection.TypeText strMyLawyerInitials
Unload Setup
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton2_Click()
End
End Sub
Private Sub UserForm_Initialize()
Lawyer.AddItem "RLB"
Lawyer.AddItem "DLS"
Lawyer.AddItem "BJF"
YourName.AddItem "Kellyr"
YourName.AddItem "Fazals"
End Sub