Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-18-2018, 06:24 AM
Wojix Wojix is offline Userforms and DDE Windows 7 64bit Userforms and DDE Office 2010 64bit
Novice
Userforms and DDE
 
Join Date: Apr 2018
Posts: 8
Wojix is on a distinguished road
Default

Here's the code for excel:




Code:
Sub Open_Word_Doc()

    Dim WRD As Object
    On Error Resume Next
    Set WRD = GetObject(, "Word.Application")
    If Err.Number Then
      Err.Clear
      Set WRD = CreateObject("Word.Application")
    End If

    WRD.Visible = True
    WRD.Application.WindowState = wdWindowStateMaximize
    WRD.Application.ScreenUpdating = True
    WRD.Activate
    WRD.Documents.Add Template:= _
          "[Path to .dot file]", _
                NewTemplate:=False

    WRD.Selection.WholeStory
    WRD.Selection.Fields.Update
    WRD.Selection.HomeKey Unit:=wdStory
    WRD.Application.ScreenUpdating = True

    Set WRD = Nothing

 End Sub
In my Word Template, I have this in the field code:


Code:
{Set "Width" "{DDE Excel "[Path to .xls file]" [Cell Name] \t \* mergeformat}"}
I also have this VBA code in Word:


Code:
Sub AutoNew()
Create_Reset_Variables
CallUF
End Sub
Code:
Sub CallUF()
Dim oFrm As WrdFrm
    Set oFrm = New WrdFrm
        With oFrm
            .Show
    End With
    Unload oFrm
    Set oFrm = Nothing
lbl_Exit:
    Exit Sub
End Sub
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Could somebody help me with the code of my VBA userforms(Combibox - saving - editing of data) 19339 Excel Programming 2 09-14-2018 12:06 AM
Is it possible to have menubar in userforms srinivasaru Excel Programming 3 03-22-2017 03:53 AM
using office icons on userforms controls fraz627 Excel 0 05-02-2014 06:02 PM
Userforms and DDE Multiple Userforms Displaying Different Content but Returning Same Content? marksm33 Word VBA 1 02-24-2014 06:17 PM
Userforms and DDE looping controls on userforms Cbrehm Excel Programming 5 05-11-2011 02:53 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:35 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft