473,324 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

OLE Automation

3
Trying to automate the embed of word docs. Using the following code which worked for me in Acess 2k but is not working in 2003. Any suggestions?

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmd_Insert_DOC_Click()
  2. On Error GoTo errhand2
  3.  
  4.  
  5. Dim arbc As String
  6. Dim iss As String
  7.  
  8. arbc = Me![Arb_Counter].Value
  9. iss = "c:\FILES\Issue" & arbc & ".DOC"
  10.  
  11. Debug.Print fname
  12.  
  13. Decision.SourceDoc = fname
  14. Decision.Action = OLe_Create_embed
  15.  
  16. errhand2:
  17. Debug.Print Err
  18. Resume Next
  19. End Sub
  20.  
Aug 8 '07 #1
5 3307
JKing
1,206 Expert 1GB
You have posted your question in the Access Articles section rather than the Access Forum section.
I have moved it across for you.

MODERATOR.
Aug 8 '07 #2
Scott Price
1,384 Expert 1GB
Assuming that "Decision" is your named unbound object frame, you need to change the
Expand|Select|Wrap|Line Numbers
  1. Decision.Action = OLE_create_embed
to
Expand|Select|Wrap|Line Numbers
  1. Decision.Action = acOLECreateEmbed
The code you posted isn't quite complete, in that it doesn't give us any idea of where you are getting your 'fname' variable from... It LOOKS like you should be setting the sourcedoc to iss, rather than fname (unless, that is, you are declaring fname elsewhere in the module and simply passing the value here.)

Regards,
Scott
Aug 8 '07 #3
ADezii
8,834 Expert 8TB
Trying to automate the embed of word docs. Using the following code which worked for me in Acess 2k but is not working in 2003. Any suggestions?

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmd_Insert_DOC_Click()
  2. On Error GoTo errhand2
  3.  
  4.  
  5. Dim arbc As String
  6. Dim iss As String
  7.  
  8. arbc = Me![Arb_Counter].Value
  9. iss = "c:\FILES\Issue" & arbc & ".DOC"
  10.  
  11. Debug.Print fname
  12.  
  13. Decision.SourceDoc = fname
  14. Decision.Action = OLe_Create_embed
  15.  
  16. errhand2:
  17. Debug.Print Err
  18. Resume Next
  19. End Sub
  20.  
Unless you omitted some critical code, your posted code should not work at all. To programmatically Embed an Object in an Unbound Object Frame:
Expand|Select|Wrap|Line Numbers
  1. 'Define the type of Object to appear in the Field
  2. Me![OLEUnbound1].OLETypeAllowed = acOLEEmbedded
  3.  
  4. 'Specify File to be Embedded
  5. Me![OLEUnbound1].SourceDoc = "C:\Test\Test.xls"
  6.  
  7. 'Critical steps for Embedding and In-Place Activation
  8. Me![OLEUnbound1].Enabled = True
  9. Me![OLEUnbound1].Locked = False
  10.  
  11. 'Craete the Embedded Object
  12. Me![OLEUnbound1].Action = acOLECreateEmbed
Aug 8 '07 #4
Scott Price
1,384 Expert 1GB
Thanks, Adezii!

Suggestion to OP... Read Access's help file under "sourcedoc" (position cursor in the word somewhere in your code window and press F1). Not always nearly as clear as mud, but in this case I think it explains the process fairly well.

Regards,
Scott
Aug 8 '07 #5
KRB2
3
Assuming that "Decision" is your named unbound object frame, you need to change the
Expand|Select|Wrap|Line Numbers
  1. Decision.Action = OLE_create_embed
to
Expand|Select|Wrap|Line Numbers
  1. Decision.Action = acOLECreateEmbed
The code you posted isn't quite complete, in that it doesn't give us any idea of where you are getting your 'fname' variable from... It LOOKS like you should be setting the sourcedoc to iss, rather than fname (unless, that is, you are declaring fname elsewhere in the module and simply passing the value here.)

Regards,
Scott
Works like a charm...Thanks
Aug 9 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: qwweeeit | last post by:
Hi all, Elliot Temple on the 1 June wrote: > How do I make Python press a button on a webpage? I looked at > urllib, but I only see how to open a URL with that. I searched > google but no...
25
by: Neil Ginsberg | last post by:
I have a strange situation with my Access 2000 database. I have code in the database which has worked fine for years, and now all of a sudden doesn't work fine on one or two of my client's...
1
by: Jimmer | last post by:
I've got what should be an easy automation problem, but the solution simply isn't coming to me. I've got several public variables set up for automation as follows: Public gappExcel As...
1
by: Lee Seung Hoo | last post by:
hi~ :) I need all information of "Automation" or "Automation Object" what is that ? why is it useful ? How can I use that by C# or .Net Framework ?
6
by: a.theil | last post by:
Please help! I need a simple excel automation, just 2 write some files into excel. I do: Dim oXL As Excel.Application Dim oWB As Excel.Workbook Dim oSheet As Excel.Worksheet Dim oRng As...
0
by: Sharath | last post by:
Quality Globe is Glad to Offer you the Fast Track course on Automation, QTP Basics and Advanced, and Quality Center Starting Date: June 4th, 2007 Timings: 10 AM to 3:30 PM Duration: 50 Hours ...
0
by: Sharath | last post by:
"Inspired" by the huge success of our first two automation fast track batches We are forced to start third fast track automation batch ...
0
by: Sharath | last post by:
We are glad to inform you that "Inspired" by the huge success of our first three automation fast track batches We are forced to start fourth fast track automation batch ...
0
by: Sharath | last post by:
We are glad to inform you that "Inspired" by the huge success of our first four automation fast track batches We are forced to start fifth fast track automation batch ...
0
by: madihamir | last post by:
Iam new to .net and have gotten assignment for make the class library to automate the outlook I have tried to done it but i've to make the Handlers also . Detecting an methods for receiving and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.