Jumat, 12 Desember 2014

[MS_AccessPros] Re: 2 different fonts in a word cell using VBA

 

Liz

What about .Name & .Size? They are both in the IntelliSense list.

Bill Mosca


---In MS_Access_Professionals@yahoogroups.com, <liz_ravenwood@beaerospace.com> wrote :

Ah – well, regardless, it is breaking on the property ".fontname" not being a member of that class.

 

From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Thursday, December 11, 2014 2:17 PM
To: MS Access Professionals
Subject: Re: [MS_AccessPros] 2 different fonts in a word cell using VBA

 




Liz,

I think that the Tohoma Font has an "m" in it rather than an "n".


From: "Liz Ravenwood liz_ravenwood@beaerospace.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com>
To: "MS Access Professionals" <MS_Access_Professionals@yahoogroups.com>
Sent: Thursday, December 11, 2014 3:52:31 PM
Subject: [MS_AccessPros] 2 different fonts in a word cell using VBA

 

Pros, I'm automating database output to word and am having an issue.

 

I need to have the cell have a label heading in its existing font which contains bold and such for saliency, and I need to add in information from the database.  The trouble is, I splice the data in and it takes the font of the existing string. 

I even messed with the word template to see if it would retain some type of font codes and then the splice in would respect the new font.  It didn't work.  So now I'm trying this, and am getting member not found errors with the fontname.

 

Anyone ever done this?

 

   Dim objWord As Word.Application

   Set objWord = New Word.Application

   Dim oDoc As Word.Document

   Dim oTable As Word.Table

   objWord.Documents.Open newPath

   Set oDoc = objWord.Documents(1)

   Set oTable = oDoc.Tables(1)

   objWord.Visible = True

  

EnterMainData:

   ' Tracking number

   oTable.Cell(1, 3).Range.Text = oTable.Cell(1, 3).Range.Text & rsMain("TrackNum")

   ' Organization name and address

   Dim strLabel As String

   Dim strAddress As String

  

   strLabel = "4.   Organization Name and Address: "

  

   strAddress = Nz(DLookup("OrgName", "AuthorizationTypes", "AuthorizationType = '" & rsMain("AuthorizationType") & "'"), "no address found")

   strAddress = strAddress & vbCrLf & "                                    " & Nz(DLookup("OrgStAddress", "AuthorizationTypes", "AuthorizationType = '" & rsMain("AuthorizationType") & "'"), "no address found")

   strAddress = strAddress & vbCrLf & "                                    " & Nz(DLookup("OrgCityStateZipLine", "AuthorizationTypes", "AuthorizationType = '" & rsMain("AuthorizationType") & "'"), "no address found")

   strAddress = strAddress & "             " & Nz(DLookup("OrgCode", "AuthorizationTypes", "AuthorizationType = '" & rsMain("AuthorizationType") & "'"), "no address found")

  

   oTable.Cell(3, 1).Range.Text = oTable.Cell(3, 1).Range.Text & strAddress

  

   With oTable.Cell(3, 1).Range

'      With oDoc.Range(.Start, .Start + Len(strLabel)).Font

'         .FontSize = 8

'      End With

      With oDoc.Range(.End - Len(strAddress), .End).Font

         .FontName = "Tahona"

         .FontSize = 8

      End With

   End With

 

Respectfully,

Liz Ravenwood

Programmer / Analyst

B/E Aerospace | Super First Class Environments

 

1851 S Pantano Road | Tucson, Arizona 85710

Office +1.520.239.4808 |

beaerospace.com

Passion to Innovate. Power to Deliver

 



This email (and all attachments) is for the sole use of the intended recipient(s) and may contain privileged and/or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.




--

---

Jeffrey Park Jones
Excel, Access, Word, Office Expert
Excel and Access, LLC®
http://ExcelAndAccess.Com

919-671-9870
5109 Deer Lake Trail
Wake Forest, NC 27587
jpjones23@centurylink.net







This email (and all attachments) is for the sole use of the intended recipient(s) and may contain privileged and/or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.

__._,_.___

Posted by: wrmosca@comcast.net
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)

.

__,_._,___

Tidak ada komentar:

Posting Komentar