OLE Question

Microsoft OFFICE

    Sponsored Links


  • 1. Code for Opening a PDF document
    I would appreciate help with the VBA code that would open a pdf document with a known path. I plan to use this to let users open documentation from a pull-down menu Any help will be appreciated.
  • 2. Run OnLoad macro in PPT
    Is it possible to run a macro on startup in PowerPoint? How do you do that?
  • 3. code 9 - subscript out of range error
    I have a user who's getting a code 9 - subscript out of range error on a workbooks(filename).activate command. No other users have this problem, and all are using the same version of excel...... anyone got any ideas? Please? Carl
  • 4. Programming Excel Efficiently - HELP!
    My head is exploding with the 500 different ways shown on Microsoft's site to program Excel (Office) Can anyone offer the best solution to the following: I want to program a couple of Excel reports for both Mac Users and PC users and have them access from a web site. These users not only have different platforms (Mac and PC) but many have different versions of Excel (XP, 2002, 2003, 2000). What does Microsoft have out there that would be compatible with all of the above differences?? I am open to VBA, VB.Net, ASP.NET, etc........
  • 5. Set References in code
    Does anyone know how to set a reference in code rather than clicking <tools - references - etc>? I have written a program that moves macros between .dot files (using OrganizerCopy) but some of the macros require an ADO connection and I cannot work out how to copy references or set them up in code. Thankyou in advance for any / all help Parsley

OLE Question

Postby Ron » Sat, 19 Jun 2004 00:40:15 GMT

I'm using OLE to transfer data from Access to Word, the 
problem I'm having is closing the Word documents, the 
user gets a Close prompt for each document created(which 
I'm trying to avoid). Can you tell me how to close the 
documents in the code? Here is a code sample:

Dim db As Database, cSQL As String, rs As Recordset
Dim objWord As Word.Application
cSQL = "SELECT * FROM tblRespondent ORDER BY Number, Name"
Set db = CurrentDb()
Set rs = db.OpenRecordset(cSQL)
If rs.RecordCount > 0 Then        
While Not rs.EOF
'Launch Word and load template
 Set objWord = New Word.Application
 objWord.Documents.Add _
 Application.CurrentProject.Path & "\CHRONOI.dot"
 objWord.Visible = False
 With objWord.ActiveDocument.Bookmarks
 .Item("Number").Range.Text = rs!Number
 .Item("Respondent").Range.Text = rs!Name
 End With
End If
        Set rs = Nothing

Re: OLE Question

Postby Chad DeMeyer » Sat, 19 Jun 2004 00:52:49 GMT

First, I recommend you use a second object variable for the document you are

Set objDoc = objWord.Documents.Add Application.CurrentProject.Path &

I assume you want to save these documents, but just don't want the user to
be prompted.  In that case:

objDoc.SaveAs    'This method takes several arguments.  For detailed
guidance see the Word VBA help files.

Or, if you don't need to save the documents:

objDoc.Saved = True

should suppress the prompt if no other changes are made before closing the

Chad DeMeyer

Re: OLE Question

Postby anonymous » Sat, 19 Jun 2004 02:17:07 GMT

Thanks, for the advice. I appreciate it....Ron
the document you are
Application.CurrentProject.Path &
don't want the user to
For detailed
before closing the


Similar Threads:

1.OLE Question

Greetings, I would like to use OLE to extact my address book from outlook. 
What i have will get the names but i want all the info contained in the 
address book any thoughts? Here is what i have found so far

Option Explicit
Public Sub DisplayOutlookContactNames()
   Dim Outlook As Outlook.Application
   Dim NameSpace As Outlook.NameSpace
   Dim AddressList As AddressList
   Dim Entry As AddressEntry
   Dim i As Long
On Error GoTo Finally
   Set Outlook = New Outlook.Application
   Set NameSpace = Outlook.GetNamespace("MAPI")
   Set AddressList = NameSpace.AddressLists("Contacts")
   For Each Entry In AddressList.AddressEntries
      i = i + 1
      Cells(i, 1).Value = Entry.Name

   Set Outlook = Nothing
End Sub

2.VB to Perl Excel OLE question....QueryTables


I'm trying to convert this VB code:

ActiveSheet.QueryTables.Add(Connection:="TEXT;C:\perl\2.csv", _

into Perl and can't seem to get the syntax right. Can someone please
help me out? Here is what I have within Perl:


I think the Connection parameter is Ok but the syntax on the
Destination parameter is definitely not correct.

Any advice is greatly appreciated.


3.MSOutlook OLE Question


This is my first post on this forum so if i dont show comman techietal
etiquette, i sincerely apologise.

Ok so heres my question, I have an Application that Automates 
MS Outlook 2000/XP/3 "Send/Recieve All", but im having troubl
detecting when outlook has sucessfully completed either downloadin
mail or its current session even if no mail was processed.

What im currently doing(cave man style :D) is setting a timeout of 1mi
on the dial-up connection to terminate when there's no activity on th
line. Is there no programmatic way of doing this, besides having t
write my own mail client?

Any help is always appreciated!
Thnaks for any time  spent reading this.

Kind Regard

4.how to display word docs... OLE question

I am making a simple app that displays a series of Word docs. Essentially, I
just need a text box that can display essay1.doc, and a botton that changes
the document to essay2.doc.
both documents are already existing, not new files to be created.

Can anyone help? Thanks!

5.ole questions

I'm trying to retreive an incremented number from my oracle database,
and it seems to be incrementing by 2 instead of 1.  However, when I am
using a SQL writer (Benthic) it only increments by 1, so I know it's
set up correctly.  Any thoughts?

    strSql = "SELECT TW_QM_TRACKING_NO.nextval FROM dual"
    Set odyOraDynaSet = godbOraDatabase.CreateDynaset(strSql,
    strDbValue = odyOraDynaSet.Fields("DBVALUE").Value
    MsgBox strDbValue

I've verified with a counter that the code is not running through
twice, so I really don't understand why it is incrementing by 2.


6. VB6 OLE question

7. JPG, OLE, Questions on how to best use images in ACCESS

8. OLE question

Return to Microsoft OFFICE


Who is online

Users browsing this forum: No registered users and 41 guest