Results 1 to 2 of 2

Thread: Word 2007 ~ using DataObject for text ~ how can I change the font?

  1. #1

    Thread Starter
    Hyperactive Member simpleonline1234's Avatar
    Join Date
    Mar 2010
    Posts
    322

    Word 2007 ~ using DataObject for text ~ how can I change the font?

    I notice that the only font I have is the default Calibri in Word 2007. Is there an option when using the Data Object were I can set the defaul text to be Arial?

    Also I don't know if this helps but I am also putting the DataObject into the clipboard to be pasted out to another application.

    Any help would be great.

    Here is my button.

    Code:
    Private Sub CommandButton1_Click()
    Dim MyTextwil As DataObject, TextStr As String
    Set MyTextwil = New DataObject
    
    Dim name1 As String
    Dim ext1 As String
    
    name1 = TextBox1.Value
    ext1 = TextBox2.Value
    
    MyTextwil.SetText "" & vbNewLine & _
         "Phone:  " & vbNewLine & _
         "Spoke With:  NAME" & vbNewLine & _
         Date & " " & Time & " " & "(X)  Greeting  (X)  Busy  (X)  No Answer  (X)  Voice Mail " & vbNewLine & _
         "" & vbNewLine & _
         "(X)  Request Received    Resent by  (X)  Mail  (X)  Fax" & vbNewLine & _
         "Records Expected:  DATE " & vbNewLine & _
         "Summary of Discussion:    -----" & name1 & "  " & "Ext# " & ext1
        
    
    MyTextwil.PutInClipboard
    
    End Sub

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Word 2007 ~ using DataObject for text ~ how can I change the font?

    Is there an option when using the Data Object were I can set the defaul text to be Arial?
    text in a dataobject has no font information, to retain font information, the data would be in the current font of the application receiving the pasted information

    you would need to use a richtext object or similar, then copy it's content to clipboard, using some other method, such as sendmessage API, with the WMcopy constant
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width