Automating Mail Merge/Sending to Email
Hello.
I am using the Visual Basic and the Microsoft Word 11.0 Object Library to
automate mail merge and send the output via email. I have almost everything
working. I used Microsoft's examples to figure out how to do this. I ran
the following example code right from
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbawd11/html/woproMailAddressFieldName1_HV05211939.asp:
With Documents("FormLetter.doc").MailMerge
.MailAddressFieldName = "Email"
.MailSubject = "Amazing offer"
.Destination = wdSendToEmail
.Execute
End With
...having filled in all the merge fields appropriately. Upon the .Execute
call, I get the following prompt:
"A program is trying to automatically send e-mail on your behalf.
Do you want to allow this? If this is unexpected, it may be a virus and you
should choose "No"."
I click "Yes" to allow the email. It APPEARS that it's working, but no
email is ever sent or received by any of the recipients. I assume that it's
using Outlook to send the email, and none of the messages ever appear in the
out box or in sent messages, and none are ever received.
Am I missing something?
Thanks for sitting there and reading this long email!
John Tag: Splash screen Tag: 72879
Changing a style in header
Hello
I have a macro which places text from a userform into various parts of a
document and (amazingly) it works except for one line which is to change the
style of a paragraph in the primary header of Section 2. This part works:
.Headers(wdHeaderFooterFirstPage).Range.Text = TxtReportTitle
.Headers(wdHeaderFooterPrimary).Range.Text = TxtReportTitle + Chr(13) +
"Table of Contents (continued)"
But this line doesn¹t:
'Selection.Style ActiveDocument.Styles("TOC continued")
All I want to do is change the Chr(13) and the next line into the
abovementioned style. I have tried changing ³Selection² to ³Range² but that
doesn¹t work either.
Can someone help me with the correct VB syntax for this?
Also, I¹d like to add a manual line break (^l) into my macro but I don¹t
know what the CHR code for that is. I understand that chr(13) is for
paragraph breaks (^p).
Thanks for any help. Tag: Splash screen Tag: 72876
Save Macros Query -- Network Issue
Per the conversation about saving/sharing macros and the MVP document on
same.
Author Johathan West says:
****
They can do this easily, by creating a batch file, containing an xcopy
command, and getting the login script to call the batch file. An example of
such an xcopy command might be:
XCOPY [server path] [local path] /D /Q /Y /R /I /C /K /S
****
My question: Is anyone doing this in an XP environment with workstations
formatted with NTFS file system. My boss seemed a bit skeptical. We've been
running into more than a few permissions issues while making this transition
and I'm wondering if the suggested technique will work in XP/NTFS and if
not, what alternatives are recommended?
Sincerely,
Ridge (in New Joisey) Tag: Splash screen Tag: 72875
Remote Server error
I am using the code below in Access to create a Word document, 1st time it
works fine, 2nd time I get an error that it cannot find the remote server. I
get it on the line wdApp.ActiveDocument.PageSetup.LeftMargin =
InchesToPoints(0.5). Any suggestion will be greatly appreciated!
Jerry
Dim wdApp As Object
Dim docFinal As Object
' Create new hidden instance of Word.
Set wdApp = CreateObject("Word.Application")
wdApp.Visible = True
Set docFinal = wdApp.Documents.Add
docFinal.PageSetup.Orientation = wdOrientPortrait
docFinal.PageSetup.DifferentFirstPageHeaderFooter = False
docFinal.SaveAs FileName:="" & wdFname & "", FileFormat:=wdWordDocument
'Activate the current window
tmpFinalDoc = GetFileName(wdFname)
wdApp.Windows(tmpFinalDoc).Activate
wdApp.ActiveDocument.PageSetup.LeftMargin = InchesToPoints(0.5)
wdApp.ActiveDocument.PageSetup.RightMargin = InchesToPoints(0.5)
wdApp.ActiveDocument.PageSetup.TopMargin = InchesToPoints(0.5)
wdApp.ActiveDocument.PageSetup.BottomMargin = InchesToPoints(0.5)
.....
'Save the document and close
docFinal.SaveAs FileName:="" & wdFname & "", FileFormat:=wdWordDocument
docFinal.Close
wdApp.Quit wdDoNotSaveChanges
Set docFinal = Nothing
Set wdApp = Nothing Tag: Splash screen Tag: 72874
Linecount
Hallo everybody.
I have a little problem with WORD: I need to have document's number of
lines, but i dont' find anything.
I found only the insrtuction LINECOUNT, but it's available only for the
userforms.
Can you help me?
Guido Tag: Splash screen Tag: 72864
Macro Paste Special
I would like to create a macro that will do a Special Paste (from the
clipboard) as unformatted text.
The paste is coming from an Excel file and everytime I run the macro it
pastes it as a table and I want it unformatted.
Help !! ... Thanks a bunch
JW :o) Tag: Splash screen Tag: 72855
CustomDocumentProperties
After having added a custom document property (using "Add") how can I know
whether it is or not in my document ? If I call Add again it crashes down
saying the property exists already. Tag: Splash screen Tag: 72854
save macros in other projects other than normal
Can macros be saved with names other than "normal"?
If yes, is there any way to make macros available to many different files
(grouped in some way)? Tag: Splash screen Tag: 72851
How to format Excel chart within Word
I am able to insert an Excel chart into a word document, but do not
understand how to set myself up to edit the chart: This is the code I am
trying to use. What do I need to do?
Dim oObject As Object
Dim oInlineShape As InlineShape
Set oObject =
Selection.InlineShapes.AddOLEObject(ClassType:="Excel.Chart.8", FileName:= _
"", LinkToFile:=False, DisplayAsIcon:=False)
Set oInlineShape = oObject.OLEFormat.oObject
With oObject
With .activesheet
'Format the embedded chart.
.ChartArea.Font.Size = 8
.HasLegend = False
.Application.Update
etc, etc. Tag: Splash screen Tag: 72844
Opening a Mailmerge Word Document from Excel using VBA
Any explanation an assitance would be greatly appreciated.
I have an excel [2000] file that I use to generate a mail merge data set for
word.
Using VBA, I create a excel file with one [1] sheet, then open word, and an
existing mail merge document with all the fields. I then relink the merge
document to the new data file and merge.
This all works but takes approx. 1 minute to the file, and another minute to
relink the new data file. If I open the document through word manually, it
only takes about 3-5 seconds to open the word document, similar to relink.
Can someone first explain the time lag, and/or how to fix it?
Thanks
Simon
[Note: Also posted in Mail Merge group] Tag: Splash screen Tag: 72836
Option Buttons - Word 2003
I have a form with groups of option buttons for selection. Is there a way to
make the value of the option button "true" as the user tabs up or down
through the selections, i.e., the option is selected at the location the user
has tabbed to and moves with the tab action? I am trying to come up with a
way to select the option without using a mouse on the form. Right now I have
accelerator keys assigned but these become problematic with the quantity of
selections on the form. I couldn't seem to locate anything in the properties
window of the form that sounded like it would fit the bill.
Thanks!
--
singeredel (Julie) Tag: Splash screen Tag: 72833
how to populate a listbox in word vba
Hi,
How do i get a list of names (I have the five names I need) to appear on a
list box on an word vba form. I have created the vba form and listbox1 but I
can't see how to get the names on there?
Thanks in advance
Go Tag: Splash screen Tag: 72825
Proper coding of AddOLEObject
I am trying to use VBA code to enter a line of text, and then add an MSGraph
Chart on the very next line, anchored to the text. I am using the following
code, but need to know what to use for the Anchor property:
Selection.TypeText Text:="My text goes here"
Selection.TypeParagraph
Dim oWordApp As Word.Application
Dim oWordDoc As Word.Document
Dim oShape As Word.Shape
Set oWordApp = GetObject(, "Word.Application")
Set oWordDoc = ActiveDocument
'Embed a chart on the document.
Set oShape = oWordDoc.Shapes.AddOLEObject( _
Width:=150, Height:=150, _
ClassType:="MSGraph.Chart", DisplayAsIcon:=False, _
Anchor:=<<<WHAT GOES HERE?>>>) Tag: Splash screen Tag: 72824
Selection.Tables.Add -- moving the selection
I'm using office automation in Word.
I have a selection and have used Selection.Tables.Add to add a table into
word.
How do I move the selection to the end of the table (i.e. next line?)
If I were to do Selection.TypeText("blah") the text is inserted in the first
cell of the table, which is NOT what I want.
I've tried methods like Selection.Move and MoveEnd... but it doesn't seem to
work. Maybe I'm using it wrong? Any help would be greatly appreciated,
Thank you,
Ray Tag: Splash screen Tag: 72820
Word Remove Nonprintable characters
I have characters that look like little boxes in my text in Word. The text is
being brought in from a mainframe download. I want to get rid of these
characters but I can't seem to figure out how. Tag: Splash screen Tag: 72819
InlineShapes
I'm writing an application that make some operations with some objects stored
as inlineshapes in a word document, but when I insert an Autoshape in Word
XP, and an activeX object (CalendarControl) as an inline object, then
InlineShapes.Count returns 1 (I guess because of the calendar control), but
when I try to get the item with InlineShapes.Item(1), it throws an exception,
saying that the item is out of range.
I must get the CalendarControl with InlineShapes.Item(2), despite that the
count property returned that there are only 1 element (count returned 1).
When I check Shapes.Count it returns 1 as well. (I guess because of the
autoshape)
I must get the AutoShape with Shapes.Item(1);
So it seems that there are 2 collections (InlineShapes and Shapes) that
share the indexes.
Is this a bug?
How could I now which index is a InlineShape and which one is a Shape? in
order to not to get the exception when I use the .Item(index) member?
Thanks. Tag: Splash screen Tag: 72815
Class does not support Automation or does not support expected int
Hi,
G'd morning. In Office 2003, I created a Word template which has a word
document, VBA code, and couple of FORMs. And, I'm getting very strange error
when I change the template.
I added a new textbox, an activeX obj, to the word document, but it seemed
that the old document, created without the new textbox, didn't like the new
textbox somehow, I think.
I got the following error:
Run-time error '430':
Class does not support Automation or does not support expected interface.
the code:
ActiveDocument.txtCompanyName.text = "My Company"
txtCompanyName is the name of the textbox created before.
If I delete the newly created obj from the template, all the old documents
work fine with the code.
I don't know if there is any change in Office 2003 on how to reference
ActiveX obj. Or, I should register the objs before I reference to them in VBA
code.
Is anyone has come across this type of problem?
Thank you very much.
Will.
-- Tag: Splash screen Tag: 72813
Controlling an external application from Word
Hello guys!
I have a Word medical report and a audio file with the info which must be
written. There is a simple application who runs the audio file. What I want
to know is if I can send a play/pause instruction to that application from
Word!
Is there anyway to do this? I believe I could create a "play" and "pause"
macros (and associate them to a key, for instance)...
I thank anyone who could help me!
Best regards,
--
Ricardo Pinto Tag: Splash screen Tag: 72812
Word Fields
I am using Word 2002 I have a field code (field on the insert drop
down) that on click needs to select the field (1 or more words) and
then if the user starts typing the text needs to change color and
format. I am new to field codes so i need lots of help Tag: Splash screen Tag: 72810
Templates on Word 2000
I have a problem with the template on my Microsoft Word 2000
Every time that I open a new window to write something, I always see a
phrase from a previous text that I wrote. Can somebody advise, please, on
how to rectify this?
Many thanks in advance.
CR Tag: Splash screen Tag: 72807
code for formatting
Hi,
I want a code for formatting a document with the following options. Will any
one guide me with a code for accomplishing this task ?
FONT TAHOMA
FONT SIZE 12
MARGINS LEFT : 3.6 CMS (1.417â??)
TOP : 2 CMS (0.787â??)
RIGHT : 1.7 CMS (0.669â??)
BOTTOM : 1.76 CMS (0.693â??)
Paragraph spacing 1.5 JUSTIFIED
Thank you in advance Tag: Splash screen Tag: 72802
How to setup Select Variable Page Headers
Would someone please advise me on how to setup my document (which undergoes
many changes) so that I can select variable Headers or change the pre-defined
Page 1 Header automatically? I thought of setting file(s) with different
header texts that would be copied/pasted from the pre-defined text
automatically into the body of the 1st pg Header. However I haven't a clue
as to exactly where to start and how to Get the header text needed.
thx,
Ted Tag: Splash screen Tag: 72801
Speed of macros reduced to a snail pace
Hi
I recently asked a question about two docs that use the same .dot as
reference to execute macros and install a toolbar.
One of the docs works very well while the other one (much longer table) has
become unusable due to the speed of execution
Today, I inserted a second table in the slow doc and the macros executed
right away.
So I have concluded that it is the length of the main table in the
problematic doc that is causing the problem and nothing else.
I have copied below one of the macros the speed of which seems to be
affected by the length of the table.
Can anyone help me to get around this problem as I can't wait one minute
each time for a macro to execute.
I selcet the word with the cursor before running the macro.
Thanks in advance
Dave Neve
Sub FallingLong()
Dim wordrange As Range, lrange As Range, i As Long, j As Long
Set wordrange = Selection.Range
j = 2
For i = 1 To wordrange.Characters.Count
Set lrange = wordrange.Characters(i)
If Selection.Characters.Count <= 5 Then
lrange.Font.Size = 18
lrange.Font.Size = lrange.Font.Size - j
j = j + 2
lrange.Font.Spacing = 5
wordrange.Font.Color = wdColorSkyBlue
Else
lrange.Font.Size = 16
lrange.Font.Size = lrange.Font.Size - j
j = j + 1
lrange.Font.Spacing = 5
wordrange.Font.Color = wdColorSkyBlue
End If
Next i
Selection.Collapse Direction:=wdCollapseEnd
Selection.ExtendMode = False
Selection.Font.Reset
Call NextWordSelect
End Sub Tag: Splash screen Tag: 72795
combine downloaded word docs from website?
Hello,
This is a long shot, but I'm thinking you folks would probably have
some pointers for me.
On this website:
http://www.cityofbellevue.org/page.asp?view=7863
There's a set of links to months. If you click on one of the months
(say, August), you get a set of links to Microsoft Word doc files, 3
for each day of the month:
http://www.cityofbellevue.org/page.asp?view=38806
Is there a way to combine all of these docs into one document, then
sort by district? Would this be something I could do with vba?
thanks for any pointers!
Sylvia Tag: Splash screen Tag: 72793
Resequencing Paragraph Outline Numbering
Hello Everyone,
I'm trying to automate a task. I want the user to select the original
text (example below), execute the macro and convert it to what looks
like in the reformatted example. The assumptions is that there will
never be more than 30 entries for any level of outline numbering. The
text is all plain text as well and all the paragraphs have no styles
associated with them. I've tried coding finding and replacing using
loops but was getting hung up on keeping the numbering together. Any
easy ideas on how to do this?
Original Text:
1. First Paragraph.
a. Sales Plan.
b. Strategy.
(1) Strategy 1.
(2) Strategy 2.
(3) Strategy 3.
c. Marketing Plan.
2. Second Paragraph.
a. Intent
b. Concept of Execution.
(1) Execution 1.
(2) Execution 2.
(3) Execution 3.
Reformatted Text:
1. First Paragraph.
1.a. Sales Plan.
1.b. Strategy.
1.b.(1) Strategy 1.
1.b.(2) Strategy 2.
1.b.(3) Strategy 3.
1.c. Marketing Plan.
2. Second Paragraph.
2.a. Intent
2.b. Concept of Execution.
2.b.(1) Execution 1.
2.b.(2) Execution 2.
2.b.(3) Execution 3.
Thanks for the help!
Terry Hagen Tag: Splash screen Tag: 72792
Can Word 2003 preserve the intrinsic formatting of XML documents?
----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.
http://www.microsoft.com/office/community/en-us/default.mspx?mid=28931d78-3c0d-4e79-9593-6f8e33e4e7d0&dg=microsoft.public.word.vba.general Tag: Splash screen Tag: 72761
File Open Dialog based on startup directory
Hi,
I'd like for word's File-Open & Save-As dialogs to point to the directory
from which I launched word. For example, I might just launch winword.exe from
the command line, say in directory: c:\abc\xyz in which case I'd like for
File-Open & Save-As to point to this directory. Could you point me to
suitable VBA source-code or inbuilt word menu options by which I can achieve
this ?
Thanks,
Anand. Tag: Splash screen Tag: 72741
Help, my template file size is out of control!!
Hi all. I've been following everyone's advice and creating a template
and using styles, no direct formatting, etc etc. Now, my template has
grown to over 1 MB and there is not even any content to it yet!!
Is there a way I can go through the document and see what's eating up
all the space?
(my latest addition was a table of contents and table of figures, and I
noticed that jumped it up from 450k to 1.1MB ... however, it seems like
450k is even too large!!) Tag: Splash screen Tag: 72735
Programmatically creating charts with Word and VB.Net
Hi to all!
I have an issue that has been bugging me for quite some time and I hope that
someone might be able to point me into the right direction here.
The story is â?? I am writing an application that would allow a user to create
a Word output from pre-defined data tables. The output can contain both
charts and tables. While generating the output, Word or MSGraph cannot be
visible to the user. What I have is something like this
[CODE]
private sub AddChart(params)
Dim oShape As Word.InlineShape
Dim oChart As Object
oShape =
_wordDocument.Bookmarks.Item("\endofdoc").Range.InlineShapes.AddOLEObject(ClassType:="MSGraph.Chart.8",
FileName:="", LinkToFile:=False, DisplayAsIcon:=False)
oChart = oShape.OLEFormat.Object
If (chartOptions.UpdateDataSheet(oChart) <> True) Then
CLogger.Log("Chart has no data present. Check to make sure you
are not hidding the entire chart", CLogger.EntryType.Warning)
End If
CLogger.LogIf("Updating Chart Options")
chartOptions.UpdateChart(oChart)
oChart.Application.Update()
oChart.Application.Quit()
AddSection()
End sub
[/CODE]
Here is what happens â?? first time we run this â?? everything is good, second
time, Word document becomes visible as well as the MSGraph window appears.
It happens when we hit the line with oShape = ��.
I am wondering if someone knows the way to hide that Word document and that
MSGraph window.
Thanks in advance. Tag: Splash screen Tag: 72730
How do I UNHIDE ALL the toolbars in Word?
Whenever I start up Word, I only see the Blue bar at the top of the window
and the blank Word document. There are NO TOOLBARS shown (at the top,
bottom, or on the sides of the window). How do I get the toolbars back? Tag: Splash screen Tag: 72727
set field sequence mandatory completion in form
I would like to create a form with the the first few fields to be a mandatory
completion before going on to the next. Tag: Splash screen Tag: 72725
Track changes, deletions and additions
I have a bunch of documents with addition and deletion markups.
I want to make a macro that will go through an entire document, find
everything that is a deletion, put a true strikethrough on it, then deny the
changes, so it stays on page, and keeps the strikethrough.
Then i want the macro to go through and find all additions, font.color them
wdColorRed, and accept the changes, so they're on the document and color of
red.
If anyone can help it's much appreciated. Tag: Splash screen Tag: 72704
Auto-create chart objects
I have an excel spreadsheet with 600 rows in it. Each row has the name of an
item followed by several columns of numbers.
I need to create 3 different small charts in a Word document for each row in
the spreadsheet. In word, you will see a Item Name, with 3 small, but
different charts on the next line, followed by a blank line.
I know I can create the charts in Excel using a macro and then copy and
paste them into word as pictures. Once that is done, I can tell word to run
a macro to format the pictures. But the quality of the text breaks down
depending upon how much I stretch the charts.
WHAT I WOULD RATHER DO is, either from Excel, tell word to insert Excel
chart objects or from Word, get the data from Excel and create the chart
objects.
Using the first method, I have created a macro in Excel to tell Word to run
a macro to put in a line of text with the item name in it, followed by a
paragraph break, followed by inserting an Excel object. But where do I put
the macro that tells the Excel object how to format itself? I do not want to
store the macro in each Excel object as that would bloat the document. I
have tried to place the Macro back in the original Excel sheet, but when I
tell it to run, it seems to want to run within the original Excel sheet, not
within the Excel object in Word.
What am I doing wrong? Or am I missing something even simpler that would
solve my problem? Tag: Splash screen Tag: 72703
View.ShowBookmarks problem
Hello,
if I change the value of View.ShowBookmarks for a specific document =
window, it seems that Word will remember the setting and apply it to the =
all the documents it opens subsequently.
Is there a way to avoid this?
Best wishes,
Alex.
--=20
Address email to user "response" at domain "alexoren" with suffix "com" Tag: Splash screen Tag: 72702
Word 2000 Merge with VBA
I have a name badge document that I routinely merge with an Access data base
on a server. I create name badges for several offices. Each office is
generated with a make table and 2 append queries, with a query for the final
data.
The final data query for each office is used to create the name badges for
each office.
I recorded the merge process for one query, then copied for each office.
The code is:
Sub Merge_EventsDataBase_HOU()
'
' MailMerge Macro
' Macro recorded 8/17/2005 by cm9125
'
ActiveDocument.MailMerge.OpenDataSource Name:= _
"I:\Access\Registration_Lists_Pinnell\RegistrationLists_Original.mdb", _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
Format:=wdOpenFormatAuto, Connection:= _
"QUERY Qry-N_B-Office-HOU-4-FinalData", SQLStatement:= _
"SELECT * FROM [Qry-N_B-Office-HOU-4-FinalData]", SQLStatement1:=""
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With
End Sub
Copied this code and changed the query name for each of the other offices.
This code ran fine, but when I tried the other offices got "Run-time error
'5922': Word was unable to open the data source."
Can someone help me with this? Also, on my computer it goes to the "I:"
drive. On someone else's computer it may not be "I:". Is there a way to let
the other user enter their drive number? Tag: Splash screen Tag: 72697
genreate ms-word doc from excel
Hi all,
I have worked on an excel project recently with a lot of help form
this board. The goal was to assort couple of tables from one sheet to
another to make things easier for comparison. Now I have a new task. I
need to generate couple of ms-word documents from this excel sheet. The
plan right now is to have a menuitem like "Generate docs" in excelsheet
and by clicking on that we can generate about 40 word documents or so.
We have a word template file. For each word document we need to have
the folowing things
1. Module name as the heading
2. Description of the module
3. Table of data
All these information are in the excel sheet. They are stored in excel
sheet using named ranges. Now, I need to gather these data and generate
the word docs. What would be the best approach to solve this problem.
Ideally we would like to do this with out even opening the word
application. I am requesting your valued suggestions on this problem.
Thanks in advance,
shishi Tag: Splash screen Tag: 72694
Passing values from one .dot file to another .dot file
Iam New member for this group!!!!
My project is to pass values from .dot file to another .dot file (lets
say two .dot files test1.dot and test2.dot)
test1.dot: When user runs the macro go(), the wizard / form will be
open to enter the employee number, once he enters, it prints the
Employee number in a document (Doc1) and saved it to the disk, after
this it will open test2.dot
test2.dot: This should calculate the salary based on the employee
number received from the test1.dot, and attach the salary component to
the earlier created file (Doc1) by test1.dot
Iam not sure how to pass the values from one .dot file to another .dot
file
test1.dot code
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Private Sub CmdFinish1_Click()
ActiveDocument.Bookmarks("Firs=AD=ADtName").Range.Text =3D
Me.txtFirstName.Text
ActiveDocument.Bookmarks("EmpN=AD=ADumb").Range.Text =3D Me.TextBox1
test1.Enabled =3D False
ActiveDocument.SaveAs FileName:=3D"C:\doc1.dot"
ActiveDocument.SaveAs FileName:=3D"C:\doc2.dot"
Call test2
Unload Me
Application.Quit
End Sub
Public Function test2()
Dim wrdAppl As Word.Application
Set wrdAppl =3D New Word.Application
wrdAppl.Documents.Open ("C:\test2.dot")
Set wrdAppl =3D Nothing
End Function
test2.dot code
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Private Sub Document_Open()
ActiveDocument.Bookmarks("bksa=AD=ADlary").Range.Text =3D salary
test2.Show
End Sub
Public Function salary() As String
Dim sal As String
If
(ActiveDocument.CustomDocument=AD=ADProperties.Item("Employee").V=ADa=ADlue
=3D "1") Then
salary =3D "100K"
ElseIf
(ActiveDocument.CustomDocument=AD=ADProperties.Item("Employee").V=ADa=ADlue
=3D "
") Then
salary =3D "Salary not generated"
End If
End Function
Private Sub CmdFinish2_Click()
ActiveDocument.Bookmarks("Last=AD=ADName").Range.Text =3D
Me.txtLastName.Text
Dim Doc1 As Word.Document
Set Doc1 =3D GetObject("C:\doc1.dot", "Word.Document")
Doc1.Range =3D Doc1.Range + ActiveDocument.Range
Doc1.SaveAs FileName:=3D"C:\doc3.dot"
Doc1.Close 'close doc3
Set Doc1 =3D Nothing
Unload Me
ActiveDocument.Close 'close test2.dot
End Sub
in test2.dot
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
I have written code to read the values from customdocumentproperties if
we want to see manually ..open any document go to File menu ->
Properties -> Custom Tab.
What i need is to get the employee number from test1.dot to the custom
properties of the test2.dot so that i can perform necessary salary
calculations
If any of know how to pass the values from .dot file to another .dot
file will be a great help
You can directly mail to me if you need the test1.dot and test2.dot
files for any clarification
I will also update the groups as and when required=20
Thanks=20
Srini Tag: Splash screen Tag: 72693
OT: Agent Forte and Private Groups
Hi everybody,
since the last harddrive crash I'm trying without success
to get back to the private groups. I'm using agent forté.
Maybe someone can help me via EMail,
as I don't want to molest the group with this.
Might become a long story, as I am completely lost
and I don't have the faintest idea where to start.
Helmut Weber Tag: Splash screen Tag: 72689
Problem with Word Code in 2003
I am performing a mail merge in Word through an Access database. As part of
the process, I check to see if a Word document is already a mail merge
document, and then, if it is, if it has the correct data source. Thus, from
within Access, I use:
If objWord.ActiveDocument.MailMerge.State=wdMainAndDataSource Then
...
This has worked fine with Access/Word 2000, or if the program is used with
Access/Word 2002. However, with Access/Word 2003, the MailMerge.State value
returns wdNormalDocument (0) instead of wdMainAndDataSource (2). I
double-checked the document, and it clearly is a mail merge main document
with a data source. When when read through Access, I get the return value of
a normal document.
Any ideas as to what's going on?
Thanks,
Neil Tag: Splash screen Tag: 72688
date code question
I am trying to modify the date code field to automatically populate a date in
my word document X number of days from the present date. Would I be able to
modify the following to accomplish this task and if so, how would you go
about doing it?
{ DATE \@ "dddd MM/dd/yy"}
So, when this document is edited today (08/18/05), the code will produce:
Thursday 08/18/05
I want to modify the code so it is always smart enough to add X days to the
date automatically. So, if I wanted it to display a date 7 days into the
future (X=7), output would automatically be adjusted to display:
Thursday 08/25/05
How can the date code listed above be modified to accomplish this? Thanks. Tag: Splash screen Tag: 72687
Controlling text wrapping around an image.
Hello
We generate word documents from content in a database (AuthorIT
application). I want to have an image on the front page of my document
_behind_ the text. When generated, the text is wrapped around the image. I
want to use a macro to set the image to display beneath the text.
I have come up with this macro:
Sub MoveImage()
Dim iShape, Shape
On Error Resume Next
For Each iShape In ActiveDocument.Sections.First.Range.InlineShapes
iShape.ConvertToShape
Next
For Each Shape In ActiveDocument.Sections.First.Range.ShapeRange
Shape.WrapFormat.Type = wdWrapThrough
Next
End Sub
This doesn't work when run as soon as the doc is generated, but curiously
does work if i manually select the image then run it.
Can anyone help me to develop a macro that will set the desired wrapping
without any manual action?
Thanks
Dave. Tag: Splash screen Tag: 72671
HELP!!- Object or class does not support set of events
Hi. I'm trying to run a mailmerge from VB6(sp6) which produces a set of
labels. It works fine from my development machine but when I install the app
anywhere else I get the error above.
I'm not even sure where to start in trying to solve this error. Any help at
all would be greatly appreciated.
I'm developing on XP and the project references Microsoft Word 11.0 Onject
library...if that helps.
Thanks Tag: Splash screen Tag: 72668
Some method to have allways 'macro' docs ?
Hello again :
I know all the conditions regarding macro security, but I really want a
corporate system to avoid that somebody can't open a doc without use it's
autoopen macro.
I know about server solutions, but my ask is the next : If user have top
level of security set, is it possible to force to user to execute corporate
macros ?
Thanks and excuse my bad english
Antonio Pérez Tag: Splash screen Tag: 72665