Results 1 to 5 of 5

Thread: How to control Word via DDE in MS Access

  1. #1
    Join Date
    Sep 2010
    Posts
    12

    How to control Word via DDE in MS Access

    I am in Access 2010 and wants to control Word via DDE. So I have written a code in Access (all just stolen) . But unfortunately breaks me off even at DDE Initiate, it could not find the application and the specified topic. What am I doing wrong? Is there any sample code for Access 2010? The following is the code that I am trying :
    Code:
    As Long Dim lngChannel 
    lngChannel DDEInitiate = ("Excel", "System") 
    
    DDEExecute lngChannel '[OPEN ("& Chr (43) &" C: \ Documents \ Book1.xls "& Chr (43) &")] " 
    DDETerminate lngChannel 
    
    lngChannel DDEInitiate = ("Excel", "Book1.xls") 
    MsgBox DDERequest (lngChannel, "R1C1") 
    DDETerminateAll
    I am looking out for some help, tried to search it on internet but didn't find any appropriate solutions. So this is my last hope, please help me soon.

  2. #2
    Join Date
    Feb 2010
    Posts
    531

    Re: How to control Word via DDE in MS Access

    The simplest workaround:
    Code:
     Sub TestDDE () 
      As Long Dim lngChannel 
      ObjWord As Object Dim 
    
      Set objWord = CreateObject ("Word.Application") 
      lngChannel DDEInitiate = ("WinWord", "System") 
    
      'Here your DDE actions 
    
      DDETerminate lngChannel 
      objWord.Quit 
      Set objWord = Nothing 
      End Sub
    The procedure runs without errors for me. I am sure that you too were looking for the same code. Also I checked your code..
    lngChannel DDEInitiate = ("Excel", "System")
    If I open Excel before this line continues to run the code. I think that you should try changing the variables.

  3. #3
    Join Date
    Sep 2010
    Posts
    12

    Re: How to control Word via DDE in MS Access

    I have a database on the network for multiple users. So that the database can be used by several people I will start a macro when the call from the related tables (Excel) data in an Access table writes. My problem is if someone already has the database open is the start of the macro mist, as the second user now gets an error message and can not use the DB. My question is there a VBA macro command I can put the front of the macro says only start when the table is not used or if no other user is accessing the database.?

  4. #4
    Join Date
    Feb 2010
    Posts
    125

    Re: How to control Word via DDE in MS Access

    I was also having the similar issue. So that with the FE and BE, I just made, but it initially pushes only the tables in the BE, the linked Excel tables remain so in the FE and if I now start macro (for the update of tables) sharp turn I have again the problem of the second a macro error gets reported and can utilize the database can not. You can also link to Excel spreadsheets so BE and from there returning to the BE. So the macro does nothing else but a table update query the data from the Excel spreadsheet into an Access table to conjure to then access it again. Since I have found the so all tables can work with, but when I put the info directly to Excel shortcuts take off I get the error, the Excel table is being used exclusively.

  5. #5
    Join Date
    Feb 2010
    Posts
    155

    Re: How to control Word via DDE in MS Access

    OK, in VBA could catch the error and ignore the. Even do not get a more user an error message on the site. Alternatively, you write to the above update a value in a table and check off. If it does exist, was the Update query already executed, perform otherwise. Also if you are looking for the code, this will definitely help you :
    Code:
    Private Sub Form_Open (Cancel As Integer) 
    
    'Check if current date is in the table 
    If Nz (DMax ("ActDate", "tblUpdate")) <> Date Then 
    'Leave now already Action Date 
    CurrentDb.Execute "INSERT INTO tblUpdate (ActDate)" & _ 
    "VALUES (date ());" 
    'And here's your import code 
    stDocName = "create table" 
    DoCmd.SetWarnings False 
    DoCmd.RunMacro stDocName 
    DoCmd.SetWarnings True 
    
    End if 
    End Sub

Similar Threads

  1. Replies: 4
    Last Post: 06-12-2011, 07:07 AM
  2. What is Media Access Control and Logical Link Control
    By Pakhi in forum Networking & Security
    Replies: 4
    Last Post: 10-01-2011, 11:53 AM
  3. No access to Fan Control from BIOS
    By Frieda in forum Operating Systems
    Replies: 5
    Last Post: 05-11-2010, 01:36 AM
  4. Control Access through Remote Access Policy grayed out
    By Amie in forum Operating Systems
    Replies: 3
    Last Post: 01-08-2009, 09:18 PM
  5. Regain control of Word 2003 - Word 2007
    By Conrad in forum Tips & Tweaks
    Replies: 0
    Last Post: 03-01-2009, 01:20 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,040,527.98225 seconds with 16 queries