Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / May 2008

Tip: Looking for answers? Try searching our database.

about opening a word template in MS Access 97

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tahseena Ishrat Ahmed - 12 May 2008 06:18 GMT
Dear Group

I can open Word from Access using the following expression.

Dim mobjWordApp As Object

  Set mobjWordApp = CreateObject("Word.Application")
  mobjWordApp.Visible = True

But I want to open a Word Template ( .dot) that I created.

Can I get any help about it?
My Access version is Access 97

Signature

Regards

Tahseena Ishrat Ahmed

Tahseena Ishrat Ahmed - 12 May 2008 06:44 GMT
Dear Group

My question was not complete. In Ms Access 97, I want ot open a Word
Template, that I created. But the actual purpose is I want to open a report
in Word, which I can do using DoCmd.OutputTo Command to a RTF file.

Can I open this RTF file to this Template file?
Signature

Regards

Tahseena Ishrat Ahmed

> Dear Group
>
[quoted text clipped - 9 lines]
> Can I get any help about it?
> My Access version is Access 97
Tom Wickerath - 12 May 2008 08:16 GMT
Try using GetObject instead of CreateObject. I haven't tested this in Access
97, but I think it should work.

   Set mobjWordApp = GetObject (Path)

Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

> Dear Group
>
[quoted text clipped - 9 lines]
> Can I get any help about it?
> My Access version is Access 97
Tahseena Ishrat Ahmed - 13 May 2008 04:13 GMT
Dear Group

I am trying with the following code to open a word template at first and
then to open a rtf file, or doc file in it. But my problem is whenever I try
to execute this code, I get an error in the line marked '*******

Please give me a solution. I cannot proceed with this code to open the rtf
file, because before executing that line it is showing error. My code is

Function Open_WordDoc()
On Error GoTo Err_Open_WordDoc

Dim oApp As Object
Dim doc As Object
Dim wrdApp As Object
Dim DocPath As String

DocPath = "H:\Document_Heading.dot"

Set wrdApp = CreateObject("word.application")
Set doc = wrdApp.Documents.Add(DocPath)  '****** showing Errror in this line

'doc.OpenDataSource Name:="H:\QUOTE_REPORT.rtf"

wrdApp.Visible = True

Exit_Open_WordDoc:
Exit Function

Err_Open_WordDoc:

MsgBox Err.Description
Resume Exit_Open_WordDoc

End Function

Private Sub Command1_Click()

Call Open_WordDoc

End Sub

Signature

Regards

Tahseena Ishrat Ahmed

> Try using GetObject instead of CreateObject. I haven't tested this in Access
> 97, but I think it should work.
[quoted text clipped - 20 lines]
> > Can I get any help about it?
> > My Access version is Access 97
Tom Wickerath - 13 May 2008 06:38 GMT
Although written for Office XP (2002), this download might be helpful to you:

    The Office XP Automation Help file is available for download
    http://support.microsoft.com/?kbid=302460

Sorry, I don't know of a similar download for Office 97.

Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

> Dear Group
>
[quoted text clipped - 37 lines]
>
> End Sub
Tahseena Ishrat Ahmed - 13 May 2008 06:39 GMT
Dear Group

I have another problem. In access 97, if I want to declare a variable named

Dim appWord As Word.Application   or
Dim docs As Word.Documents

I get compilation error: User defined type not defined

Do you think, I should select something in Reference, I have already select
Microsoft Office 11.0 Object Library, but it still showing the same
compilation error.

Please solve my problems.

Signature

Regards

Tahseena Ishrat Ahmed

> Dear Group
>
[quoted text clipped - 62 lines]
> > > Can I get any help about it?
> > > My Access version is Access 97
Tom Wickerath - 13 May 2008 06:48 GMT
You need to select the Microsoft Word {version} Object Library, if you are
going to use early bound code. You may not even need the reference that you
have added for the Office Object Library.

Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

> Dear Group
>
[quoted text clipped - 10 lines]
>
> Please solve my problems.
Tahseena Ishrat Ahmed - 13 May 2008 07:09 GMT
I do not understant your solution.

Signature

Regards

Tahseena Ishrat Ahmed

> You need to select the Microsoft Word {version} Object Library, if you are
> going to use early bound code. You may not even need the reference that you
[quoted text clipped - 20 lines]
> >
> > Please solve my problems.
Tom Wickerath - 13 May 2008 07:38 GMT
I'm sorry, but what is it that you don't understand???
You've apparently got two lines of code repeated below, that are considered
early bound code (actually, you added the word "or" on the end of the first
line, but I'll assume that was a typo):

Dim appWord As Word.Application
Dim docs As Word.Documents

This code requires a checked reference to the "Microsoft Word x.x Object
Library", where x.x represents the version number (sounds like it might be
11.0 in your case, so I'm assuming you have Office 2003 without Access
installed, plus your older copy of Access from Office 97.

Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

I do not understant your solution.


--
Regards

Tahseena Ishrat Ahmed
__________________________________________

"Tom Wickerath" wrote:

You need to select the Microsoft Word {version} Object Library, if you are
going to use early bound code. You may not even need the reference that you
have added for the Office Object Library.

Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________


Dear Group

I have another problem. In access 97, if I want to declare a variable named

Dim appWord As Word.Application   or
Dim docs As Word.Documents

I get compilation error: User defined type not defined

Do you think, I should select something in Reference, I have already select
Microsoft Office 11.0 Object Library, but it still showing the same
compilation error.

Please solve my problems.

Signature

Regards

Tahseena Ishrat Ahmed

Tahseena Ishrat Ahmed - 13 May 2008 23:22 GMT
Dear Tom

I added as reference

Microsoft Office 11.0 Object   and

OLE Automation

But still it does not work. Please suggest me a solution.
Signature

Regards

Tahseena Ishrat Ahmed

> I'm sorry, but what is it that you don't understand???
> You've apparently got two lines of code repeated below, that are considered
[quoted text clipped - 51 lines]
>
> Please solve my problems.
Tom Wickerath - 14 May 2008 15:01 GMT
Tahseena,

> I added as reference
> Microsoft Office 11.0 Object   and
> OLE Automation
> But still it does not work. Please suggest me a solution.

I'm not surprised at your result. Are you?  I've already given you the
correct solution, but for whatever reason, you seem to be refusing to
implement it. Go back and re-read what I have written thus far.

Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

> Dear Tom
>
[quoted text clipped - 5 lines]
>
> But still it does not work. Please suggest me a solution.

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.