Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old September 29th, 2004, 04:19 AM
GUID GUID is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 69 GUID User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 45 m 29 sec
Reputation Power: 5
Unhappy Creating Word Doc from Access

I'd posted this in the Access forum, but had no responses.

I've written a function which creates a MailMerge Letter in Word from Access, but keep getting an Error, the RPC Server is unavailable. I thought maybe it was if no instance of word was already running, but this doesn't seem to matter, it's just happens every other time I run the code. I've got no help file on this issue, so if someone could help? Even an explanation of the error would be something??

I'll paste in to point where code breaks.

Function CreateInsLetter(icID As Integer)
Dim wdApp As Word.Application, wdDoc As Word.Document
Set wdApp = CreateObject("Word.Application")
Set wdDoc = CreateObject("Word.Document")
wdDoc.SaveAs ("Test1.doc")
With wdDoc.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientPortrait
.TopMargin = CentimetersToPoints(2.54) 'Breaks Here

Reply With Quote
  #2  
Old September 29th, 2004, 10:30 AM
AnnaChen AnnaChen is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Location: USA
Posts: 73 AnnaChen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 5 h 58 m 29 sec
Reputation Power: 4
Can you try this to see if it works:

Function CreateInsLetter(icID As Integer)

Dim wdApp As Word.Application, wdDoc As Word.Document

Set wdApp = CreateObject("Word.Application")
wdApp.Documents SaveAs ("Test1.doc")
With wdApp.Documents.PageSetup
.LineNumbering.Active = False
.....

Reply With Quote
  #3  
Old September 30th, 2004, 03:24 AM
GUID GUID is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 69 GUID User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 45 m 29 sec
Reputation Power: 5
Thanks Anna,

I get a Function or Variable not defined error at SaveAs.

I've had a look for help on Microsoft.com, they say this is a Bug and have a workaround for it, but this doesn't work either. They suggest creating a temporary Word App object before creating the one to us, then deleting the temporary one. This doesn't solve the problem though either. I'm using Access97 on NT also and wonder whether this is the reason. Any other help? I've been on this for a couple of days now and running out of steam...

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Creating Word Doc from Access


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway