Changing the default formatting for Word's standard buttons
Can anyone help me figure out how to change the default formatting for the
bullet and numbered list buttons on Word's formatting toolbars? I have
created my own toolbar with both a bullet and numbered list button, but
having both confuses all the end users. I removed the standard buttons, but
the users then get confused as to why sometimes they are there (when they use
normal.dot) and sometimes they aren't (when they use my template). A mutiny
is pending... unless I can just change how things look when I use Word's
standard buttons!
Thanks in advance.
--
cmbrown Tag: it wasn't right Tag: 87907
Doc property into another document
I know this is the programming group, but I hope one of you generous people
will know this.
I have 2 documents, A and B. I am interested in putting a doc property of
Doc
A into Doc B.
I think a field reference would be good, but I have only found references
for bookmarks, not doc properties.
Any recommendations?
Thanks Tag: it wasn't right Tag: 87905
gross lines
I need to know how to change a "gross line" into a "65 character line
including spaces" for medical transcription. Any suggestions?
Thanks Lori Tag: it wasn't right Tag: 87901
DocVariables - Copy / PasteSpecial
I populate a word doc from an excel spreadsheet using doc variables.
This document will enventually go to a client, so I would like the
DocVariables "removed", while keeping the values themselves. similar
to a copy / pastespecial / values works in excel.
I can accomplish this manually in word by highlighting the variable,
hitting copy / paste special / unformatted text. However, when I try
to do so in VBA, it seems to simply copy back the DocVariable.
Here is the code:
set wrdApp = Word.Application
Dim myField As Field
For Each myField In ActiveDocument.Fields
Debug.Print myField.Code
myField.Result.Select
wrdApp.Selection.Copy
wrdApp.Selection.PasteAndFormat (wdFormatPlainText)
Next
Why would this work manually, but not via VBA? I've tried other
(wdFormat...) options, but with the same result.
Thanks for any help!!! Tag: it wasn't right Tag: 87896
Need to add .png or .ico icons to the .dll
I created toolbar for my macros i need to put icons instead of text buttons.
When I copy/paste icons quality will be lost ,look is not sharp enough.(bmp).
I created icons in (png,ico) fromat with magenta(255,0,255) color with is
used by
windows as trasparent color.
Q: how can I add icons to the .dll?
Q:in which .dll
Q:Can I add it to my own dll and then insert reference in my .dot on
myown.dll.
Ps: some tutorial would be useful
thanks in advance
acherony Tag: it wasn't right Tag: 87892
VBA count of mis-spelled words?
How can I get a count of mis-spelled words in a document, using VBA?
Basically, the number of words with the red squiggly underline, although
related errors like mixed capitalization would also be of interest
especially if I could keep that count separate from the basic count of
mis-spelled words.
Thanks!
--
The enclosed questions or comments are entirely mine and don't represent the
thoughts, views, or policy of my employer. Any errors or omissions are my
own. Tag: it wasn't right Tag: 87888
Make a drop down field compulsory & create another
I have a drop down field in a Word form that must be completed either Yes or
No. If the answer is Yes the user must select from a further list of options
before proceeding to fill in the rest of the form. If the answer is No the
user can proceed to fill in the form.
1. How do I make the dropdown field compulsory (they can't move on until
something is completed I have a blank field in the dropdown so they shouldn't
just leave it blank)?
2. How do I generate another dropdown list if they answer Yes?
I am presuming VBA is the way to go but I am a VERY novice user of VBA Tag: it wasn't right Tag: 87885
ChangeFileOpenDirectory reverts template???
Hi,
I'm having this bizarre problem with some of my documents:
I have two Word documents opened, Doc 1 and Doc2, both with attached
templates.
1. I change the attached template to Doc2 (UI or AttachedTemplate
property by code, the result is the same), setting the full path (not
default), not just the name.
2. I save Doc2.
3. On Doc1 (based on a precise template one, this doesn't happen for
all documents) I change de file open directory programatically
(ChangeFileOpenDirectory method)
--> Attached template to Doc2 doesn't change.
4. Close and re-open Doc2
--> Attached template to Doc2 reverts to what it was previously. If I
attach several templates in a row it always "remembers" the one before
the last one.
Does anyone have an explanation for this?
What could be happening?
Why is this only happening whem issuing the ChangeFileOpenDirectory
from documents (Doc1) based on this one exact template?
What should I search for in the code of this template that can be done
wrong?
Although I have quite some experience with VBA, I did not write most of
the code myself, so I really have no idea where to start searching. (I
was asked to add a macro that would attach a template to all files in a
folder, which I did looping all documents in the folder, opening,
setting the AttachedTemplate to the full path of the template file,
saving and closing, which should be pretty standard).
Thanks for any help you can give
Tiago Tag: it wasn't right Tag: 87880
prinitng selctions
i need to print from page 1 to page n
page n is te one in which i find text "Chapter 2"
as my selection is located at chapter 2 (page 7 for example, but not always
7!))
how can i use ActiveDocument.PrintOut Range:=wdPrintFromTo, From:="1",
To:=n ??
how can i know in vba the current page number?
i need to use this for printing from chpater 1 to last page of chapter 1
then same for chpater 2 and 3
tya Tag: it wasn't right Tag: 87879
Word 2000 - fade edges of photo inserted in document
Word 2000 bulletin in progress: have a photo Dad wants to fade the edges on
for cover (oval, square shape etc). He has done this previously years ago but
can't remember how he did it, or which program. I've tried Picture Editor and
see no such effect, same for Paint (all XP 2000 versions).
Can anyone give tips on how one might do this?
--
AJ Tag: it wasn't right Tag: 87875
Field Codes
I am trying to add a field code in word to pull from our public folder
contact list. ie, company names, numbers, addresses....so when the user goes
to this document and clicks on the "to" it's pulls from outlook contacts.
Does anyone know the best way to accomplish this task? thanks in advance. Tag: it wasn't right Tag: 87870
DocumentBeforeSave Event error
Hi, everybody.
I am trying to move file from one folder to another, back and forth
depending on user's actions.
However, when the move file procedure is triggered by the DocumentBeforeSave
event, Word shuts down completely with the message
"Microsoft Office Word has encountered a problem and needs to close. We are
sorry for the inconvenience",
and I am not able to trap this error.
File is successfully moved if the sub is called by subs other than
DocumentBeforeSave.
Please help. I have spent close to 2 weeks on this problem. Tag: it wasn't right Tag: 87869
Font Substitution
Hello
OS: Windows XP
App: Word XP
I would like to obtain some VBA that will permanently convert all
Substituted Fonts to "Times New Roman". The code below will permanently
convert a single known substituted Font. I am looking for VBA that will loop
through all Substituted Fonts.
Application.SubstituteFont UnavailableFont:="Times New Roman Bold",
SubstituteFont:="Times New Roman"
PLease don't burn too much midnight oil on this one, however, a result would
be outstanding.
Regards
Mike Tag: it wasn't right Tag: 87867
Can't Merge Cells in Word after Splitting and deleting
Hi, I will try to explain my problem the best I can. I have a table
and the first column's text went with 6 rows (in the 2nd column) so the
first column was merged to show this. I split cells in the first
column to go with the 6 adjacent rows, then I deleted some rows, and
tried to remerge the first column and it won't give me the option to
merge. I can merge some of the cells, but can't merge the ones that
went above the rows I deleted. Any information on how to fix this
problem would be greatly appreciated!
Thanks! Tag: it wasn't right Tag: 87864
DAO OpenRecordset in Word 2000 VBA returns nothing
I'm having an unusual problem with DAO and VBA in Word 2000. Here's the
problem code:
set myRecord = myDatabase.OpenRecordset(someQuery)
"myDatabase" is an open database connection to an Access database file
(mdb file), "myRecord" is a Recordset object, and "someQuery" is an SQL
query string; e.g. "select * from thisTable where thisField=SomeValue"
The problem is, if "someQuery" returns 0 (zero) rows, then myRecord
isn't "set" - it remains uninitialized. Later on in the code, a test
like this is used:
do while myRecord.EOF = False
' do something
loop
This causes a problem in Word 2000 (but not later versions of Word)
because "myRecord" is not set, so you get a "object variable or with
block variable not set" error.
My question is this: is the behavior of "OpenRecordset" different under
Word 2000's VBA? Or have I been wrong all this time in assuming that if
the query passed to OpenRecordset returned 0 (zero) rows, it would at
least return an empty (i.e. EOF=True) recordset? Or is this maybe just
a strange problem with a particular installation of Word/VBA/JET/DAO? Tag: it wasn't right Tag: 87859
CTRL+Tab Gives VB Error
Word 2003
I have a user who has reported a strange problem in Word. I have my
doubts as to whether or not this problem is caused by Word, but since
the user is getting a VB error in Word, I thought that I would start my
research by posting the problem in this group.
When the user hits CTRL+Tab she gets the following VB error.
Error 91: Object variable or With block variable not set
The user also uses a program called CrossEyes, which is supposed to be
like the WordPerfect Reveal Codes command for Word. The user has
noticed that if she opens CrossEyes and then closes it, she can then go
in to Word and use CTRL+Tab without getting the VB error. This leads me
to believe that one of my least favorite programs--CrossEyes--is the
real culprit. Has anyone seen this problem before, or have an idea of
what might be causing the error?
--Tom
P.S.
I detest CrossEyes because the information that it gives is of limited
use, not always accurate, and the program has become a crutch for our
old WordPerfect users by helping them to continue to think in terms of
how WordPerfect does things, which just prevents them from ever truly
understanding Word. But that's just my opinion. Tag: it wasn't right Tag: 87854
My Microsoft Word is askin me to convert? What do I do?
I am tryin to use my Microsoft Word and a little box would pop up abnd say I
need to convert. then it ask for a 16 digit number but i dont have a number
and I dont have a program i bought my computer but the program was already on
the computer. I need a 16 digit number. what do i do? Tag: it wasn't right Tag: 87853
Hidden rows appearing on open
I'm using the following VBA to hide rows based on the selected checkboxes.
However, if I close the document and then reopen it, the hidden rows appear,
but sort of squashed. Any ideas?
Sub AutoOpen()
Dim myArray1() As Variant
Dim myArray2() As Variant
myArray1 = Array("Regular", "24 Hour Priority", "Same Day Urgent")
With ComboBox1
.Clear
.List() = myArray1
End With
myArray2 = Array("Test1", "Test2", "Test3")
With ComboBox2
.Clear
.List() = myArray2
End With
End Sub
Private Sub CheckBox1_Click()
CheckBox1.Font.Bold = CheckBox1.Value
If CheckBox1.Value = False Then
CheckBox1.Font.Size = 10
ActiveDocument.Tables(1).Rows(2).Range.Font.Hidden = False
Else
CheckBox1.Font.Size = 12
ActiveDocument.Tables(1).Rows(2).Range.Font.Hidden = True
End If
End Sub
Private Sub CheckBox2_Click()
CheckBox2.Font.Bold = CheckBox2.Value
If CheckBox2.Value = False Then
CheckBox2.Font.Size = 10
ActiveDocument.Tables(1).Rows(1).Range.Font.Hidden = False
With ActiveDocument.Tables(1).Rows(2).Borders(wdBorderTop)
.LineStyle = wdLineStyleDot
.LineWidth = wdLineWidth025pt
.Color = wdColorGray25
End With
Else
CheckBox2.Font.Size = 12
ActiveDocument.Tables(1).Rows(1).Range.Font.Hidden = True
With ActiveDocument.Tables(1).Rows(2).Borders(wdBorderTop)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth225pt
.Color = wdColorBlack
End With
End If
End Sub
Private Sub CheckBox3_Click()
CheckBox3.Font.Bold = CheckBox2.Value
If CheckBox3.Value = False Then
CheckBox3.Font.Size = 10
ActiveDocument.Tables(1).Rows(1).Range.Font.Hidden = False
With ActiveDocument.Tables(1).Rows(2).Borders(wdBorderTop)
.LineStyle = wdLineStyleDot
.LineWidth = wdLineWidth025pt
.Color = wdColorGray25
End With
Else
CheckBox3.Font.Size = 12
ActiveDocument.Tables(1).Rows(1).Range.Font.Hidden = True
With ActiveDocument.Tables(1).Rows(2).Borders(wdBorderTop)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth225pt
.Color = wdColorBlack
End With
End If
End Sub
Private Sub CheckBox4_Click()
CheckBox4.Font.Bold = CheckBox2.Value
If CheckBox4.Value = False Then
CheckBox4.Font.Size = 10
ActiveDocument.Tables(1).Rows(1).Range.Font.Hidden = False
With ActiveDocument.Tables(1).Rows(2).Borders(wdBorderTop)
.LineStyle = wdLineStyleDot
.LineWidth = wdLineWidth025pt
.Color = wdColorGray25
End With
Else
CheckBox4.Font.Size = 12
ActiveDocument.Tables(1).Rows(1).Range.Font.Hidden = True
With ActiveDocument.Tables(1).Rows(2).Borders(wdBorderTop)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth225pt
.Color = wdColorBlack
End With
End If
End Sub
Private Sub CheckBox5_Click()
CheckBox5.Font.Bold = CheckBox2.Value
If CheckBox5.Value = False Then
CheckBox5.Font.Size = 10
ActiveDocument.Tables(1).Rows(1).Range.Font.Hidden = False
With ActiveDocument.Tables(1).Rows(2).Borders(wdBorderTop)
.LineStyle = wdLineStyleDot
.LineWidth = wdLineWidth025pt
.Color = wdColorGray25
End With
Else
CheckBox5.Font.Size = 12
ActiveDocument.Tables(1).Rows(1).Range.Font.Hidden = True
With ActiveDocument.Tables(1).Rows(2).Borders(wdBorderTop)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth225pt
.Color = wdColorBlack
End With
End If
End Sub Tag: it wasn't right Tag: 87851
Override Regional settings within app
Hi,
I would like to override the regional settings (e.g. for the decimal char
and the thousand separator) within an application. Is this possible and mor
eimportant... how?
Thx,
Christian Tag: it wasn't right Tag: 87843
http interface from inisde VBA
Hi:
I want to send data using a cgi script via a http interface to the server
from indide a VBA code. Is that possible? I know of something called "HTTP
package" that Tcl provides. I was looking something similar to it. Any help
is appreciated.
Thanks. Tag: it wasn't right Tag: 87839
Failed SaveAs Makes Documents Invisible (Mystery with clues)
I am using Word 2003 (11.8026.6360) Sp1 (VBA)
When the execution of a "SaveAs" fails; as in the following statements;
ActiveDocument.SaveAs _
FileName:="D:\Documents and Settings\henryhiggin\My
Documents\Billminer\doppel.txt", _
FileFormat:=wdFormatText, _
LockComments:=False, Password:="", AddToRecentFiles:=True,
WritePassword _
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False,
SaveAsAOCELetter:= _
False, Encoding:=1252, InsertLineBreaks:=True,
AllowSubstitutions:=False, _
LineEnding:=wdCRLF
ActiveDocument.Close
The followinf statements ignore all open word docs;
passgo:
For Each docOpen In Documents
docOpen.Close SaveChanges:=wdDoNotSaveChanges
Next docOpen
The clue is that; although the documents can be closed manually; one
cannot select "SaveAs" from the "File" menu.
Is there a way of closing these stubborn files programatically?
Thanks Tag: it wasn't right Tag: 87832
trapping run-time error 4198
I am experiencing a run-time error 4198 when comparing certain Word
documents using vba (from Access 2000 - automating Word 2000). In
general, I think it is caused when trying to compare documents that
have already been compared. My problem is that I cannot trap the error.
I have an On Error goto statement right before the doc.Compare filename
statement, but it does not go to the error handler when the error
occurs, instead presenting the 'Command failed' message to the User and
then showing the yellow highlight on the Compare command when the
'Debug' button is clicked. I have tried setting the DisplayAlerts to
each of the 3 different choices right before the Compare, all to no
avail. Behaviour remains the same. The same code works fine for many
other documents, but I want to gracefully be able to handle this
problem, even if it is only to log the error and move on to the next
file to be processed.
Any ideas on why I can't trap this error? Anything different I can do?
Any way I can detect if the file has already been compared, and thus
avoid comparing when it would cause this error?
Any help much appreciated, Thanks
Christine Tag: it wasn't right Tag: 87831
Enabling spellcheck for protected forms in Word 2003
I believe that I have followed the instructions in
http://word.mvps.org/FAQs/MacrosVBA/SpellcheckProtectDoc.htm
to attempt to enable spellcheck for a protected form. Unfortunately, I
can't get this to work and Tools/Spelling and Grammar remains greyed-out.
The process I used was to Create a new macro and paste in the code from the
referenced URL, having deleted what Word put inb automatically.
I have also created a very simple .dot file and tried to enable spellcheck
using the same macro, but still Tools/Spelling and Grammar is greyed-out
I note, BTW, that if I delete this macro, I am still told when opening these
files that they contain macros. I don't understand this.
I have run the example on the referenced URL and this works fine.
I am using Word 2003.
Any help much appreciated .... this is my first attempt to use Word macros.
Thank you
Gordon Marwood Tag: it wasn't right Tag: 87823
Add macro to the doc and change reference.
Hi!
I created Template with some macros.I put in Trusted Location on Server.
every user can select template and create new document.
in my templates i created Menu&Toolbar&Styles and I need it to be inherit to
the
*doc file.
It is working well in company, while the reference point to the location of
template.
My problem is : when doc file is sent via email to the other company then
the reference will be unknow and Word select default reference Normal.dot
which don´t include my Menus&Macros&style...
1. I copied Macros to the doc file project while creating.
2. I add Menu also while creating
but when I send it to the another company word set as Normal as reference
and the
Forms&Procedu&menu&toolbar will be ignored.
I hope you guys undestood what my problem is and I really need some help.
Q: How can I solve this problem?
I tried to delete reference it is not working!
Q:Maybe have can I attach whole Template to the .doc file (doc size don´t
matter).
Q:any other solution.
Here is some code I used to add Items & Styles
sub autonew()
.
.
.
'Update styles
ActiveDocument.CopyStylesFromTemplate
Template:=ActiveDocument.AttachedTemplate.FullName
.
.
.
.
Application.OrganizerCopy Source:= _
ActiveDocument.AttachedTemplate.FullName, Destination:= _
ActiveDocument.FullName, _
Name:="UF_translation", Object:=wdOrganizerObjectProjectItems
Application.OrganizerCopy Source:= _
ActiveDocument.AttachedTemplate.FullName, Destination:= _
ActiveDocument.FullName, _
Name:="UserForm_Frontpage", Object:=wdOrganizerObjectProjectItems
.
.
end sub
Thanks Tag: it wasn't right Tag: 87817
Collecting Footnote reference text
I wish to collect the actual text displayed in the footnote references in my
document. Of course, just using Footnote.Index only gives you a numeric
index, and while you can query the FootnoteOptions to work out that the
format is say, lowercase letter, this doesn't help if the document editor
has chosen to restart the footnote numbering at some point. And
Reference.Text just returns an ASCII char 2.
The following code shows an example of collecting each footnote and its
reference. How do I collect the Reference's displayed text?
Dim doc As Document
Dim sect As Section
Dim note As Footnote
Set doc = ActiveDocument
For Each sect In doc.Sections
For Each note In sect.Range.Footnotes
If (note.Reference.Start >= sect.Range.Start And
note.Reference.End <= sect.Range.End) Then
Debug.Print note.Reference.Text & " " & note.Range.Text
End If
Next
Next
Using Word XP and Word 2003 Tag: it wasn't right Tag: 87814
Duplex Printing
I have managed to get the duplex printing working from the code found
on
"Controlling the Printer from Word VBA
Part 2: Using VBA to control Duplex, Color Mode and Print Quality"
which is much better than using sendkeys as I was before.
However the even pages are printing upside down. Have I done something
wrong or it is a querk from my printers (HP Laserjer 8150 PCL 5e
Thanks Tag: it wasn't right Tag: 87811
Pasting charts to Word from Excel as picture
Hi,
I want to transfer some charts (as picture) in excel to a particular
word document (specific page and specific position). The word document
already has some data and lots of pages in it and Im inserting charts
in specific places.
When I used to do the above task for Excel to Power- point then I could
use the, Right click Format picture, of Size (Height, Width) and
Position on Slide (Horizontal, Vertical) in order to place the charts
in powerpoint in the exact position and dimension I want.
But Im not able to see an analogous feature in word where I could
specify the Position (Position on page - Horizontal and Vertical) of
object/chart in Word. When I do right click on a picture in Word, then
size tab has height and width (Good for me), but I dont have any tab
for position. What we do have is a tab called Layout, in which the
"Advanced" button has Absolute position ... to of the column and
Absolute position .... below paragraph. Im not sure whether by using
these 2 properties I will be able to position my chart in the place I
want.
Again, I have not been able to try the above because of 2 reasons:-
a) If I copy paste a chart named as Chart1 in excel to Winword then
what is the name of that object in word? For checking this I recorded a
macro in word where I selected a newly pasted chart from excel and see
that the code it produces is
ActiveDocument.Shapes("Group 1570").Select
Knowin the name of the chart in word seemed important to me, because as
soon as im done pasting, the cursor in word moves to the new line or
rather the chart object is no longer active in word. So, if it is not
active then how do I apply positional and size properties to it?
b) Secondly, Im not sure of the of the exact syntax for applying
positional and size properties. When I record a macro in word where I
change the Height/width/Abs Position Col/ Abs Position Para to 2 inches
then I get lot of recorded code out of which following seemed relevant
to me (I have snipped rest).
Selection.ShapeRange.Height = 144#
Selection.ShapeRange.Width = 144#
Selection.ShapeRange.Left = 180#
Selection.ShapeRange.Top = 126#
Selection.ShapeRange.Left = InchesToPoints(2)
Selection.ShapeRange.Top = InchesToPoints(2)
Im not able to understand as to why the Left and Top (Probably the
positonal parameters for object) is getting recorded twice and that too
in different units (once as 180# and another time as
InchesToPoints(2)).
Also, I want to know one more thing. As I have already mentioned I have
text data in word and I have left enough space so that when a new chart
gets pasted the text data below the chart doesnt get shifted down. For
example, in the below code Im first navigating to the page where I want
to paste chart and then pasting it. In this whats happening is that,
even my page title and rest text gets shifted. How to avoid this
situation
Sub StartTransferProcess(WkbookNam As String, ShtNam As String, ChtNam
As String, _
Pageno As Byte, Height As Double, Width As Double, ColPos As Double,
ParPos As Double)
Set SWinword = GetObject(, "Word.application")
Set Sdocument = SWinword.Documents(WordDocName)
Workbooks(WkbookNam & ".xls").Activate
Sheets(ShtNam).Select
ActiveSheet.ChartObjects(ChtNam).Activate
ActiveChart.ChartArea.Select
ActiveChart.ChartArea.Copy
Sdocument.Activate
Sdocument.ActiveWindow.Selection.GoTo What:=wdGoToPage,
Which:=wdGoToNext, Name:=Pageno
Sdocument.ActiveWindow.Selection.Paste
''' New code to be written for Positioning and sizing object
End Sub
Regards,
HP
India Tag: it wasn't right Tag: 87808
Restrict Editing
I have created a word document that has fields that can be filled in by the
user.
I also have other text in the document that I do not want the user to
change/delete etc.
Is there I way I can protect these areas of text?
Thanks for any help
Roger Tag: it wasn't right Tag: 87802
Create Word document from Access Query - Import image based on pat
Hi,
I need to create a Word document using data from an Access query. I can do
this successfully using a mail merge. One of the fields is the UNC path to an
image. I would like to insert the image into the document each time a new
record is read. For example
<<Field1>> <<Field2>> <<Field6 - Pathname>>
<<Field3>> <<Field4>>
<<Field5>>
---------------------------------------------------------------
Field6 - Pathname is replaced by the actual image. Can the image also be
resized?
I do this in access using
If IsNull(Me.Expr1) Or IsEmpty(Me.Expr1) Then
Me.Image30.Picture = "\\server\path\noimage.jpg"
Else
Image30.Picture = Me.Expr1
End If
Where Expr1 is the path.
Can I do similar in Word VBA? My end user requires the output in Word so
they can further format it before incorporating it into a book.
Have I confused everyone yet?
thanks
Scott Tag: it wasn't right Tag: 87801
Code execution on footer change
I am trying to get some code to run when a changes is made to the footer in a
word document any ideas on how to do this. Tag: it wasn't right Tag: 87795
Mail Merge: Save every page with the value of cells in excel...
Dear all,
I have a word document that takes values from an excel file.
In my excel file, there are 5 columns and the third column represents the
supplier code.
It takes values from the excel sheet and when i run mail merger, it gives me
about a document with 150 pages...
And then i manuelly split every ! page according the supplier code.
I want a code that makes it automatically.
The code will do something like that;
for 1 = 2 to 150 (would change to the number of suppliers)
Fill the linked places from excel file to word document
document name = suppliercode
save document
close document
next
The problem is i couldn't find a way to use excel from word macro :(
Can you please help me?
Regards..
PS: The automation is not have to do everything. I can open the document,
show the data adres. I just want it to save every page automatically with the
name of the supplier code... :( Tag: it wasn't right Tag: 87793
Closing down Outlook using word VBA
Is it possible to use VB code in a word macro to check if Outlook is running
and if so to close outlook down?
Thanks? Tag: it wasn't right Tag: 87792
Can a password be applied to a folder?
Is there a method for password protecting a folder rather than having to
protect each file in that folder. Tag: it wasn't right Tag: 87788
FAQ - Frequently Aske Questions - vba - please read before posting - unofficial July posting
FAQ = Frequently Asked Questions - brief - vba - unofficial
This FAQ is posted every ten days or so.
Please save us all some time by reading it before posting to the
news group.
This newsgroup is about VBA - Visual Basic for Applications -
which is the programming language for Word 97-2003 (macros).
There is a longer FAQ with more questions and links that is
regularly posted in the non-VBA Word newsgroups. You may want
to check that out as well.
--- BEFORE POSTING ANYTHING PLEASE READ THESE ---
http://www.mvps.org/word/FindHelp/Posting.htm
http://www.dts-l.org/goodpost.htm
http://users.tpg.com.au/bzyhjr/liszt.html
Reading these articles will help you get a quick and meaningful
response to your question rather than just more questions for you.
It may keep your message from being screened or bounced.
A few basics, though:
(1) Be nice; everyone answering questions here is a volunteer.
(2) Post a question in only one newsgroup generally. If you
_have to_ post in more than one, post a _single_ message and
put both newsgroups in the header for that _single_ message.
(3) Do not attach anything to a message.
(4) The only really stupid question is the one you don't ask.
(5) Do not use your real email address unless you want spam.
(See bottom for sample.)
The reasons for the requests are spelled out on the web page.
A longer version of this FAQ is also on the Internet at
http://addbalance.com/word/index.htm
Newsgroup Archives:
http://groups.google.com/advanced_group_search
MVPs FAQ site:
http://word.mvps.org/FAQs/MacrosVBA.htm and
http://word.mvps.org/FAQs/Userforms.htm
To the extent there is any "official" FAQ, this is it.
---
Also, before posting, you may want to look at the following
questions to see if yours is among them.
---------- ---------- ---------- ---------- ---------- ----------
1. I see a macro in a newsgroup I would like to try. How
do I add it to my template?
http://addbalance.com/word/macrosfromnewsgroup.htm or
http://www.mvps.org/word/FAQs/MacrosVBA/CreateAMacro.htm
http://www.gmayor.com/installing_macro.htm
2. What are some good books for me to read about Word?
http://addbalance.com/word/wordbooks.htm and
http://www.mvps.org/word/Tutorials/BookRecommendations.htm
3. How can I run a macro automatically when a document opens,
closes, is created?
http://www.mvps.org/word/FAQs/MacrosVBA/DocumentEvents.htm
4. How can I distribute or backup macros / customizations?
http://word.mvps.org/FAQs/MacrosVBA/DistributeMacros.htm
http://addbalance.com/word/movetotemplate.htm
5. What is an MVP?
http://www.mvps.org/word/AboutMVPs/index.html and
http://addbalance.com/word/mvp.htm
6. I need to make a form to...
Userforms are custom dialog boxes written using vba.
If you want a fill-in-the-blanks form you want what Word
calls an online form. Look in Word's help for that,
and for more info on online forms follow the links at:
http://addbalance.com/word/wordwebresources.htm#Forms
especially Dian Chapman's series of articles
If you want a custom dialog box that you code with VBA commands
you want a UserForm. Take a look at:
http://www.mvps.org/word/FAQs/Userforms.htm
7. Where can I find more information on the Web?
http://addbalance.com/word/wordwebresources.htm#webvba
http://www.mvps.org/word/FAQs/MacrosVBA.htm
http://www.mvps.org/word/FAQs/Userforms.htm
http://www.mvps.org/word/FAQs/Customization.htm
http://www.mvps.org/word/FAQs/OfficeInterdev.htm
8. Recorded macros...
http://word.mvps.org/FAQs/MacrosVBA/UsingRecorder.htm
How do I edit or change?
http://word.mvps.org/FAQs/MacrosVBA/ModifyRecordedMacro.htm
Recorded macros are usually inefficient and sometimes just
plain don't work. Nevertheless, they often do work and can
be a good place to start!
9. How can I enter something once in a document and have it repeat
elsewhere? (Not really vba, but it keeps being asked.)
http://gregmaxey.mvps.org/Repeating_Data.htm
10. I can't save my customizations - AutoText, menus, etc.
Can't save normal.dot...
If you have Adobe Acrobat 7 installed see the last section of
http://www.gmayor.com/lose_that_adobe_acrobat_toolbar.htm.
Otherwise, hold down the Shift key when selecting the File
menu and select Save All.
See also http://www.adobe.com/support/techdocs/331259.html.
11. How can I get a template to show up under a tab with
File => New?
What are templates? Global templates? Document templates?
http://addbalance.com/usersguide/templates.htm
Comments / corrections / additions may be sent to
wordfaq@no.spam.addbalance.com. Remove no.spam from the
address.
Posted 3 July 2006
Charles Kenyon (the editor) Tag: it wasn't right Tag: 87785
How do I export fields result from a word document to excell?
I had design a Form in MS-Word 2003, now I need just to pick the results of
the fields from the word document to excell sheet, so what shall I do? please
help. Tag: it wasn't right Tag: 87778
Returning number of rows in table and adding to formula
Hi,
I am setting up a macro that allows users to add information into an
unspecified number of rows in a table. The user adds info and then is asked
if they wish to add more and this loops (addin a new row to the table) until
they no longer wish to add info.
One of the columns in the table is a figure and I want to have it
automatically total at the end. As I do not know how many rows there will be
I am unable to specify the formula. I have been able to return the number of
rows and have defined this as "NumRows", however cannot use this in the
formula - I have tried Sum(B1:BNumRows) but this does not work. Does anyone
know how I can get the result of NumRows into my formula. FYI, I cannot use
Sum(Above) as some cells may not contain any information and this would then
not work.
thanks, Tag: it wasn't right Tag: 87775
Combobox that populates from outside source or a declared list val
I have created a word document with fields for Techs to fill out online. In
each row they will choose the customer name, error detected, etc. Each table
will hold 25 lines, or 25 different customers. I would like to find an easy
way to duplicate a combobox (drop-down), so that each row will give them the
same choice of our customers.
I know the .additem, but I don't want to repeat that list 25 times
throughout the code. Ideally I would like someone else to maintain the
document after I have created it. I can show them how to go into the code,
but I prefer if they only have to modify one area. I tried to find info on
declaring a list string, but I am not sure if I am using the correct
terminology.
Connecting to an excel, access, or other document is a possibility, but I
would prefer if it was contained all in the same file (aka word doc). I use
to be comfortable with Visual Basic, however it was over 5 years ago and I
feel like I am starting all over again.
Thanks in advance,
Maria Tag: it wasn't right Tag: 87765
How to insert a variable string at different places in a Word document?
Hi,
I want to put a string that I can vary later at different places in a
Word document. For example, I want to put a person's name in a
document at several different places in a Word document, and I would
vary that name from time to time. How can I do it with VBA or the
built-in functions of Word? Thank you.
David Tag: it wasn't right Tag: 87754
Template inheritance in Microsoft Word
Is it possible for a Word template to inherit/refernce another
template? I'm about to create several templates with different content,
but the same code och forms and would like to store all code and forms
in one template and let other localized templates inherit from a base
template.
BaseTemplate.dot
---- Template_En.dot
-------- English document.doc
---- Template_Se.dot
-------- Swedish document.doc Tag: it wasn't right Tag: 87750
Anyone know how to merge to labels?
Created a mail-merge to labels both in design and again via wizard steps and
it doesn't work
Each label includes <next record> but it starts page 2 with 2nd record, pg 3
with 3rd record, etc
Since the wizard creates this unusable document by default i assume it's a
bug - is there a work around? Tag: it wasn't right Tag: 87743
Browsing through Column
I am designing a macro in which i want to browse through a word document
containing 3 columns. How can I browse (move) around in the columns. Suppose
i want to go to last line of second column how can i do that. I don't want to
use column breaks at the end of column.
--
Kushal Tag: it wasn't right Tag: 87742
Disappearing bookmarks
I have a procedure that updates the text in bookmarks as follows:
---------------------------------------------------------------------------------------------------------
Public Sub BookMark_Update(strBookMark As String, strText As String)
Dim oRange As Range
On Error GoTo BookMark_Update_Error
With ActiveDocument
Set oRange = .Bookmarks(strBookMark).Range
oRange.Text = strText
.Bookmarks.Add strBookMark, oRange
End With
BookMark_Update_Exit:
On Error GoTo 0
Exit Sub
BookMark_Update_Error:
[error routine]
Resume BookMark_Update_Exit
End Sub
------------------------------------------------------------------------------------------------------------
I use this to insert or update all the bookmarks in my document.
However, I am having a problem with one bookmark. After I insert the
text ok in this bookmark, and I try to refer to it again, I get the
error message that this bookmark does not exist. If I look for the
bookmarks in the document ( Insert->bookmarks), I can see the name of
this particular bookmark. If I look in the Visual Basic IDE, and look
at ThisDocuments.BookMarks, I cannot see this bookmark, but I see all
the other bookmarks. The only difference between this particular
bookmark and the other bookmarks in the document is that this
particular bookmark is very lengthy and contains tab values. I am
trying to refer to this particular bookmark to create table to contains
this bookmark's contents. I have this same procedure in other
documents. As a matter of fact, I just copied the whole code from
another document, that does work. Tag: it wasn't right Tag: 87737
Drop Down Field Options - Add
Hello:
I created a fill in Word form with the controls from the Form Toolbar. One
of them is a regular text field. Users always ask for more. Now, they say
they would like to be able to have options to select so they don't have to
type each time the "teacher's name". I cannot enter those names up front
because I don't know what the list will be. I can create drop down field
with the options but how would I have the options entered by the user? This
form is protected. Can I give user access to Add Option or create some sort
of dialog so the box can accept entries. I guess it would need to be
unprotected for this to happen. Is is possible?
Woudl appreciate your help.
--
danka Tag: it wasn't right Tag: 87735
Help set a Default File Path
I have a template file I want to fix the "Save as" directory to w:\MyPath
instead of the normal "My Documents". I want to then reset to
c:\DoumentsAndSettings... upon document closure. I see the "Run Method" and
the "DefaultFilePath Property" help verbage but am somewhat clueless as to
which method is best and how to embed the code.
Thanks for the help. Office2003 Tag: it wasn't right Tag: 87727
"display name" <displayname@discussions.microsoft.com> wrote in message
news:77CAF392-AD1A-4D97-9CDA-F0FE0DF33E62@microsoft.com...
>i don't think it was right.