473,326 Members | 2,102 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,326 software developers and data experts.

Create a new MS Word object?

Hello all,
In my application I have to open a predefined MS Word document. I do this
with the following code:

Dim sDatum As String
sDatum = Date
Dim sNaamschrijver As String
Dim appWord As Word.Application
Dim wrdDoc As Word.Document
Dim strFileName As String
strFileName = "MyPath\MyFile.doc"
Set appWord = New Word.Application
Set wrdDoc = appWord.Documents.Open(strFileName, ReadOnly = True)
appWord.Visible = True
sNaamschrijver = DLookup("[Volledigenaam]", "tblMwerkers", "[username] = '"
& fOSUser_Name & "'")

Then I merge in the name of the user using the variable sNaamschrijver,
along with some other variables, which all works fine.
Then the user completes the document. After that I CANNOT allow him to save
this document at his own will. It should be saved with a certain naming
convention and at a given path. Therefore I have put a button on the
document which the user has to click. I can put in the button's code the
path where it has to be saved, but not his name. My question is: is there a
way to define a new Word object before the document opens and assigning the
value of sNaamschrijver to it - and how should it be done? After that I
could just put in in the savestring of the word document. Or maybe someone
has a better idea?

Any help very much appreciated ....
Thanks,
Ronny
Nov 12 '05 #1
0 1633

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: nicky j | last post by:
Hi, I'm sorry if this is the wrong place to ask this, please point me in the correct direction and ignore if so.. I'm trying to figure out how to run a script on my server which will go over a...
2
by: Mikey | last post by:
Sample VB .NET source code to create mailing labels or customized letters using MS Word MailMerge This VB .NET source code will start MS Word and call methods and set properties in MS Word to...
0
by: Federico | last post by:
Hi I want to create a Web Services where I receive a Template DOT word a file XML and with these I create a Document that a I'll Send as Dime Attachment. <WebMethod()> _ Public Function...
0
by: Federico | last post by:
Hi I want to create a Web Services where I receive a Template DOT word a file XML and with these I create a Document that a I'll Send as Dime Attachment. <WebMethod()> _ Public Function...
0
by: Niyazi | last post by:
Hi, I created application that store the data in SQL SERVER that reside on network. The client also use this application to access the resources provided with application. But is the client want...
23
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
0
by: Leiloon | last post by:
SALAM = Hello I want to create a word document in my C# application. I get some help and example from web and msdn.... the problem is there is this sentence in sample code: object...
5
by: Nitin Mahajan | last post by:
Guys Is there a way in C# to create a word object directly from a memory stream without passing that to hard disk (file stream). I think it doesn't makes sense to create a file just to read it...
0
by: dbsog7777 | last post by:
I was trying to use the sample code below, but I encountered two errors: Application.DoEvents() and AutoText(entry). I am not sure how to correct the errors. I trying to use the sample code to...
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...
0
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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.