how to insert a picture to a word document
how to insert a picture to a word document,and align Center both Horizontal
and Vertical Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90349
Creating a second word instance to run my project (Word 2000)
Hello
I have one last obstacle to overcome with my project. At this stage it is
working more or less as i want it, application is hidden with only a userform
in view, and my labels are printing out fine, time after time of button
clicking, documents are opening and closing correctly etc etc.
My (final???) problem now is that when I close the applicatiion the way I
need to, ie Application.Close wdDoNotSaveChanges - so that its ready to be
used again another time, it also closes with it any documents that are laying
open at the bottom of the screen - this could well cause much anguish amongst
the users who (hopefully) will be using it in our office, and I'm sure to
become little miss unpopular!!
I think one option, if it can be done, would be to fire up the document in a
new instance of word, separate from the one that is already open with
documents at the bottom of the screen. Is this possible, and if so can
someone point me in the right direction of where to place the required code.
I have seen some code in a book that will open an instance of word from
another program - do I do this in the same way? And where should the start
up code be placed?
Thanks Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90345
VBA Code
I have a seeming simple task that I can't figure out.
I have a macro set up to refresh a query and then do some copying and
pasting of cells.
What code can I use to tell the macro to wait until the query is finished
refreshing until it does the copy and paste?
Here is the simple code.
Sub GetData()
ThisWorkbook.RefreshAll
' I need the following code to be run after the refresh is finished'
Range("J5").Select
Selection.Copy
Range("J6:J65000").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWindow.LargeScroll ToRight:=-1
Range("D1").Select
End Sub Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90343
How can I stop the reviewing toolbar from popping up?
I am using another program called iRedline for document comparisons and
changes. After I compare documents with iRedline, Word's native Reviewing
toolbar pops up. It is redundant sitting there next to the iRedline toolbar;
and I don't want to confuse my users. Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90334
Print all docs in folder macro
I loaded a macro that sounded promising, that would print all documents in a
folder to a file. Wonderful. Now, how do you choose a folder to print it? I
can choose documents, but have no idea how to choose a folder. Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90324
Caption of a frame
I am desperately trying to find a way how to print the captions of my
userform's frames. Right now, these captions do appear on the userform
but do not when I print it.
Thanks for your hints on this matter.
Sebastien Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90322
Macro created one day, next day gone
I created a Macro, save to two places by gmayor. I was going to go in and
edit it. Today it is gone. Totally gone. I had saved, closed it, gone back to
it two or three times, and even added it to one of my drop down menus. It's
dead, Jim. Where did it go? Do I have to recreate it every time? WTH!? Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90313
Macros to delete track changes and comments
Is there a macro code that I could use to remove all track changes and
comments (not just hide them) before saving and sending a document? I've
tried the Reject and Accept Changes, but sometimes if I click Reject all
changes, it takes away changes that weren't tracked to begin with. And I
always have to go to View > Markup, making sure that markup is checked, in
order to reject and accept. Sometimes I'll have to delete comments
separately, sometimes I just click Accept all changes and it gets rid of
them. Is there one process that will work the same for everyone? (everyone
here is upgrading to 2003 and we have to republish some old docs)
This is confusing to instruct others about, since docs were saved in
different ways with different kinds of markups. I don't want to use the
Remove Hidden Data tool because it messes up templates and other settings.
thanks Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90311
resolving combo box data to HTML e-mail
hi,
I am creating a template in word to replace an existing paper based form
with a e-mailed word document. To do this i am using VBA in word to send the
document once finished and i am using several combo box's to select data on
the document. The problem i am having is that when the template is sent (as
HTML) the data selected in the combo box's is not sent. I would like to have
it set so that only the text selected in the combo box is sent - without any
of the actual comboi box.
(i am aware that the combo box can be sent by activating active x in
outlook, however i was hoping that there might be another way)
where can i find the answer???
thanks. Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90301
ListBox_Click event does not work!
I used ListBox couple of times and each time the click event worked fine,
but in one particular userform the ListBox_click does not work!
However it "works" when i set listbox selected value via code, for example:
ListBox1.Selected(0)=True
but when i click a value on the listbox, the event simply does not "fire"...
I checked this by placing the breakpoints inside of the click event. Of
course, nothing "breaked" because event doesnt fire....
Please help.
Thanks. Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90299
copy text
Depending on an input choice i have to select a part to copy and paste.
All the text is included in one document and i can type all i want for
bookmarks.
But how can i write the code that on choice 1 i have to copy from text
"a)" till text "b)" and so on? Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90295
RE: Opening Excel for editing
Hello,
I have a Word form that has a user form within. In this user form some data
is entered and thus written to another Word form. I would like to open an
Excel for and write some data to a cell, how can this be done? Below is a
code snippet for the Word document, I would like to write the same data to
the Excel document named 'jobs.xls'. Thanks
Documents.Open FileName:="C:\!Job Setup\Project Information.doc"
With ActiveDocument
.FormFields("ProjectName").Result = frmProjectName
.FormFields("ProjectNumber").Result = frmProjectNumber
.FormFields("ProjectTo").Result = frmProjectTo
.FormFields("ProjectAttention").Result = frmProjectAttention
.FormFields("ProjectAddress1").Result = frmProjectAddress1
.FormFields("ProjectAddress2").Result = frmProjectAddress2
.FormFields("ProjectAddress3").Result = frmProjectAddress3
.FormFields("ProjectManager").Result = frmProjectManager
.FormFields("ProjectForeman").Result = frmProjectForeman
.FormFields("ProjectSuper").Result = frmProjectSuper
.FormFields("ProjectScope").Result = frmProjectScope
.FormFields("ProjectDate").Result = frmProjectDate
.FormFields("ProjectRDF").Result = frmProjectRDF
.FormFields("ProjectPhone").Result = frmProjectPhone
.FormFields("ProjectFax").Result = frmProjectFax
.Close SaveChanges:=wdSaveChanges
End With
--
A response to the newsgroup will allow us all to learn from your expertise!
-Lumpjaw Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90287
Updating Table of Contents
Hi. I'm trying to update a Table of Contents (TOC) from a macro. Nothing I
try works. When I do it manually, I get a prompt that asks me if I want to
replace the TOC. None of the methods seem to take a parameter for replacing
the TOC, which is what I need to do. Recording the manual operations
basically gives the same code that I am using, but it doesn't work at run
time. Here's what I have now:
For Each aTOC In ActiveDocument.TablesOfContents
aTOC.Update
aTOC.UpdatePageNumbers
Next aTOC
What is the trick to regenerating a TOC that works every time?
Thanks,
Gaston Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90283
"Save to two locations" macro
I used the gmayor macro to save a document to two locations at once. It
worked wonderfully. However, with each file it saves, it puts the word
"Backup" in front of each file. Is there any way I can get around that? Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90282
IF/Then variable in form?
Anyone know how to write the code so that IF a # in a field (call it Premium)
is LESS THAN $50. THEN this field = that field plus whatever it takes to be
$50...
otherwise, the field is Zero? Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90279
assigning variable to DB field value
In the following code (brackets [] replace actual path name, etc.), what is
the syntax for assigning the value of the database field to a variable?
And a few more questions:
What would be the equivalent code for doing the same but using a recordset
just to get the data field value then assign it to a variable? In other
words, this would just retrieve the field's value and not make the document
into a merge document, correct?
If I didn't want to use the .odc shown below, what would be the correct
syntax to just reference an Access database named DB.mdb? (I'm asking because
I recorded this from a macro; and I'd like to know all the options so I can
better understand the syntax and principles behind the code.)
ActiveDocument.MailMerge.OpenDataSource Name:="[path]\[datasource].odc" _
, ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True,
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False,
Format:=wdOpenFormatAuto, Connection:= _
"Provider=MSDASQL.1;Persist Security Info=False;User ID=b;Extended
Properties=""DBQ=[path]\[database].mdb;DefaultDir=[path];" & _
"Driver={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS
Access;FILEDSN=[path]\[DSN].dsn;MaxBufferSize=2048;MaxScanRows=8;PageTi" _
, SQLStatement:="SELECT [field] FROM `[query]`", SQLStatement1:="",
SubType:=wdMergeSubTypeOther
[variable]=???
--
Thanks in advance, Bryan Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90278
Create Form with Bookmarks that are underlined
I have a problem with my form. I've created the fields for the bookmarks,
but I am unable to keep them underlined. I've tried to highlight the field
and underline it so that when it fills in it is underlined, but the text goes
before the underline.
Hope that makes sense...I'm using Word 2002
Thanks for any help. Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90276
Loadpicture in Mail Merge
I am developing a Word mail merge to create letters from an Excel
spreadsheet.
I would like to load a picture on each page using a path in the excel
spreadsheet.
I have written a macro which loads the picture.
How can I get the macro to run for each record in the mail merge?
Any thoughts or code samples would be appreciated.
Clark Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90274
Adding Bullets and Symbols to Protected Forms using Form Fields
Hello,
I have several templates that are protected using form fields...I am trying
to figure out a way to allow the users of the form to implement bullets and
symbols (such as the copyright symbol) to some the form fields.
When the user attempts to access the Insert menu or the formatting menu,
they are grayed out.
I have used the Spell Checker macro found on this site, it works great... I
am hoping there is a similar macro for these other needs.
Thanks in advance for you help!
--
Coach Tony Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90271
Word Form Fails When Using The Mouse
Hi Guys/Dolls
I'm using word forms and my program works ok when using the keyboard - using
tab key to navigate around the form but crashes when using the mouse with a
"Microsoft Office Word has encountered a problem and need to close. We are
sorry for the inconvenience".
Has anybody come across this? If so how do I resolve this. Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90270
adding autotext to a template
Jonathan is now on holiday - can anyone else help in his abence please? We
have been corresponding over the last few months - please see below. Any
help would be greatly appreciated as I'm getting quite frustrated now!!
cheers
I have a letter template macro as a form chooser and I would like to add
various autotext in a list so that they can be added to the address bookmark
in the template. Is there a way or would I have to add each company name to
a module as an additem and then put the addresses in a macro in the form
chooser? If there is a better way which will pick up the autotex which are
contained in a global template in startup then that would be great as then I
wouldn't have to add a new macro every time someone requires a new address
adding to the list.
Many thanks
Addy
In VBA, you can create a loop to iterate through the AutotextEntries
collection of any Template object, get the Name property of each
AutoTextEntry in turn and use Additem to add that to the listbox in your
form. Something like this
Dim oTemplate As Template
Dim oAuto as AutotextEntry
Set oTemplate = Addins("My Global Template.dot")
For Each oAuto in oTemplate.AutoTextEntries
ListBox1.AddItem oAuto.Name
Next oAuto
Regards
Jonathan West - Word MVP
I tried the below but it doesn't seem to work. Please could you let me know
what I am doing wrong.
The below bit I put in my form chooser:-
Dim oTemplate As Template
Dim oAuto As AutoTextEntry
Set oTemplate = AddIns("legal.dot")
The below was put in a new module:-
With frmChooser 'frmchooser is my form (a letter template)
For Each oAuto In oTemplate.AutoTextEntries
CBOAddress.AddItem oAuto.Name
Next oAuto
.Show
End With
Anyone any ideas please?
Addy
Hi Addy
This line is wrong
CBOAddress.AddItem oAuto.Name
Its should be this
.CBOAddress.AddItem oAuto.Name
Note the extra period at the start of the line. That is what links it to the
"With frmChooser" statement
Regards
Jonathan West - Word MVP
Many thanks. I've changed that but now it doesn't like this line:
For Each oAuto In oTemplate.AutoTextEntries
When I hover over oAuto it says its empty
Cheers Addy
step the through the code. After you get to this line
Set oTemplate = AddIns("legal.dot")
check whether oTemplate is actually assigned to anything. If it isn't, then
you need to fix that object assignment.
If it is correctly assigned, then check the value of
oTemplate.AutoTextEntries.Count. If it is zero, then oTemplate doesn't have
any autotext entries in it.
Regards
Jonathan West - Word MVP
> I've managed to get my otemplate to be assigned to legal.dot but it says
> my
> oauto is empty and I don't know why because there are autotext enteries in
> legal.dot. This is what I've got so far:-
>
> These are both in my form chooser:-
>
> Dim oTemplate As Template
> Dim oAuto As AutoTextEntry
>
> The below are in a separate module:-
>
> With frmChooser 'frmchooser is my form (a letter template)
>
> Set oTemplate = AddIns("o:\msoffice97\winword\startup\legal.dot")
> Set oAuto = AutoTextEntry (put this in entra as it wouldn't work)
>
> For Each oAuto In oTemplate.AutoTextEntries
> .CBOAddress.AddItem oAuto.Name
> Next oAuto
> .Show
> End With
>
> Do you have an e-mail address that I could maybe sent my whole document to
> you on to find out where I'm going wrong as it is a long and complex form
Addy
OK send it to jwest@mvps.org. I might not have time to look before I go on
holiday this weekend for a fortnight, but I'll see what i can do.
Regards
Jonathan West - Word MVP Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90265
Find double lines - vba or wildcards?
I'm trying to find all double (identical subsequent) lines in a Word-file. This is the file structure:
Saturday, Bob and Mary, 02 PM
Sunday, Bob and Raymond, 02 PM
Sunday, Bob and Raymond, 02 PM
Monday, Joan and Priscilla, 01 PM
Now, I have been trying to find all double lines with this wildcard search:
(^13*^13)@
but no double lines are found. What wildcard combination would I need to accomplish this search? Is it necessary to use vba? (Word 2002 SP3)
S. Nomey Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90249
Blue Screen Macro
I used to have a simple macro I attached to a button that pressing once would
turn blue screen on and pressing again would turn it off. Unfortunately, I
lost it in a hard drive crash. I do most of my writing and editing in blue
screen but some graphics don't appear and I need to switch to white to view
them. It is cumbersome to navigate the menus to switch. Does anybody know
this macro? Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90246
how do you edit the location of a subdocument hyperlink?
I am creating a master document with multiple subdocuments. My company uses a
datamanagement system for data storage. I am able to access documents within
the data management system via a http hyperlink. i intend to modify the
subdocument location to point to the appropriate hyperlink. is this possible
without some serious coding, and if so how would you go about this? Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90242
Adobe Comments duplicating themselves in other toolbars
I have Adobe 7.0.8. My problem is that everytime I save my macros, shortcuts,
etc in my normal.dot on Exit and then restart Word, the items in Adobe
Comments duplicated themselves in my customized toolbar, sometimes attaching
themselves to the Autotext or other toolbars. Can somebody tell me what is
happening. How can I prevent this from happening short of getting rid of the
Adobe toolbar - I have no experience in changing the registry. Thank you Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90240
Detecting a Shape/InlineShape within a track changes balloon
Hi Everyone :)
I need help with figuring out a way to detect if a Shape / InlineShape
in a Word document is actually residing inside a track changes balloon
?
I' m trying to iterate over the Shapes and InlineShapes collections of
a document in order to retrieve some properties but I would like to
skip Shapes / InlineShapes that have been deleted and are now appearing
only within the track changes context.
Thanks for your help !
Yaniv Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90237
MoveUntil method hangs
Hello,
I have a macro that causes Word to hang when the macro is run in a document
that contains comments (the comment "bubbles"). In my macro, I use the
Selection.MoveUntil method and pass in a negative number or the wdBackward
constant. If the current selection is in front of a comment, MoveUntil hangs
word if I try to "back up" over the comment.
Here is a simple macro that shows the problem:
Public Sub GoToPrevStar()
Selection.MoveUntil "*", wdBackward
End Sub
Here is an example of a simple document that can be used to reproduce the
problem:
"The * [insert comment here]quick brown fox"
If I place my cursor after the comment (for example, between quick and
brown) and run the GoToPrevStar macro, Word hangs. If I take out the comment,
the macro works fine.
I have tested this in Word 2003 and Word 2002 and it hangs in both versions.
Has anyone heard of this problem or a workaround?
Thanks,
Mike Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90236
read TOC(Table of Content), reformat TOC hierarchy and write the result into a text file
Hi,
I'd like to read the TOC starting from below "Part II test cases" until the
end of TOC. After that, I need reformat the TOC hierarchy in the format like
below and finally write the result to a text file.
Example:
TOC in Ms Word
Part II Test Cases 7
1 Schedule Document 7
1.1 Cleanup instance after scheduling. 7
1.2 WebI Specific Scheduling. 8
1.3 Document Format 9
2 Schedule to printer 9
2.1 Collate option for Crystal Report 9
3 Default Destination. 11
3.1 Alter the object destination to default destination. 11
3.2 Schedule to Default Destination. 12
Text file format:
1=/Schedule Document
2=/Schedule Document/Cleanup instance after scheduling
3=/Schedule Document/WebI Specific Scheduling
4=/Schedule Document/Document Format
5=/Schedule to printer
6=/Schedule to printer/Collate option for Crystal Report
7=/Default Destination
8=/Default Destination/Alter the object destination to default destination
9=/Default Destination/Schedule to Default Destination
Please help me!
Thank you so much. Any helps will be greatly appreciated.
Regards,
John Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90233
What did I do wrong...UserForm and AutoNew
I followed the instructiosn from MVP Microsoft on how to creat e userform.
It worked perfectly for my application; however, there were a couple fileds I
had to modify.
When I re-saved the template and opened it for a new document the userform
won't open up. Any suggestions? I am using Word 2002
The AutoNew code is:
Sub autonew()
'
' autonew Macro
' Macro created 8/28/2006 by Sondra
'
UserForm1.Show
End Sub Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90231
Using a list box in a word document
I am creating a dictation form for a surgeons office and I used drop down
boxes for the user to add in information. However, the Doc would like the
user to be able to select more than one item in a drop down box. I do see,
from the controls, that a list box or a drop down box can be placed into the
document so the user can select more than one item. My problem is getting
the list box or combo box to function. I am not familiar with the VBA
language. I have been searching MSDN but the information I do find seems to
be for VB and has not been helpful. How do I get this to function so the user
can select more than one item only showing those items that were selected?
Madalyn Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90226
How to copy RTF into another application?
Hello,
I have a macro that parses a Word Document (a resume) and creates an Outlook
contact out of it. I then copy and paste the entire contents of the document
to the Notes field in Outlook. A manual copy/paste of a Word document's
contents into the Notes field in Outlook preserves the RTF formatting.
However, when I do this programmatically, it appears as plain text in the
Notes field in Outlook. Here is the code that I'm using:
oContact.Body = ActiveDocument.Range.Text
Is there a different way to paste (in RTF format) all of the text of a Word
Document into the Notes (Body) field of Outlook Contact Item?
John Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90223
Help adding footer info on all pages
I'm new to VBA and am needing to create a macro that displays a dialog
box for the user to enter 3 lines of text. This text should then be
populated in the footer area of every page of the current document
(which will be a template with footers added). I also need to add page
numbers but place them outside footer cell and on the 3rd line down.
Here's what I have got so far .....
It works somewhat but will not put page number on 1st page.
I didn't know how to code to put the page number where they wanted it
(outside footer cell and on 3rd line), so I recorded a macro for this
piece.
I've tried bookmarks and fields also, and just cannot get the right
combination.
Seems like this should be easier than this!
Please help.
Private Sub cmdOK_Click()
Dim secTemp As Section
Dim strClient As String
Dim strProject As String
Dim strDueDate As String
'Get the input and place in variables
strClient = txtClientName.Text
strProject = txtProjectTitle.Text
strDueDate = txtDueDate.Text
Set secTemp = ActiveDocument.Sections(1)
If secTemp.Footers(wdHeaderFooterFirstPage).Exists = True Then
secTemp.Footers(wdHeaderFooterFirstPage).Range.Text = strProject _
+ vbCrLf + strClient + vbCrLf + strDueDate
Call PageNo
End If
If secTemp.Footers(wdHeaderFooterPrimary).Exists = True Then
secTemp.Footers(wdHeaderFooterPrimary).Range.Text = _
strProject + vbCrLf + strClient + vbCrLf + strDueDate
Call PageNo
End If
Unload Me
End Sub
Sub PageNo()
' 'PageNo Macro'
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or
ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
If Selection.HeaderFooter.IsHeader = True Then
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Else
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
End If
Selection.MoveDown Unit:=wdLine, Count:=2
Selection.MoveRight Unit:=wdCharacter, Count:=8
Selection.TypeText Text:=vbTab
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldPage
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90219
Gathering a total from multiple documents?
Let's say I have document A.doc, document B.doc and document C.doc and they
are identical Word documents with named form fields that perform various
calculations.
At the bottom of each document there is a field that runs a calculation
called "total"
Now I create a new document called "Grand Total.doc" and in it I put a
single form field with a calculation.
I want it to pull the "total" from document A, document B, and document C
and add them all up in this field.
Is that possible? Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90218
ComboBox Macro Issue!?
I am hoping I am posting this question to the right group. I have been
working on a word template form (Word 2003 Professional). On another
discussion group I was informed about ComboBoxes and have used three in this
particular form. Two of these are working JUST FINE...the third unfortunately
has caused me some headaches. The first problem was that when I placed all
the info in the array for the list...it for some reason refused to let me
save...stating that the disk was full (which it was not). It finally gave up
and crashed on me...forcing me to redo the combo box...this time it worked
fine and allowed me to save but now for some reason it is not showing the
list items!? They are there in VB...but when I go back to the form and
attempt to use the form...they don't show!
Any suggestions? Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90216
Finding where to insert special characters
(Referring to the text below the line)
Until recently a list of meetings was sent out as a printable .rtf file. Now
we have a Meetings page on our website but I still have to send out a
printable document or hard copy to a few members who do not have a net
connection.
Having copied the Meeting page and pasted into Word as plain text I need to
compress each event into a single paragraph, with a Manual Line Break
separating everything after the meeting subject. Unfortunately it is beyond
me to do this other than manually because the line break needs to come
before Host or Contact or Cashier or Reception, whichever is first.
Sometimes there is only a Contact, sometimes there is a Host and sometimes
there is neither so the Cashier comes first.
With earlier MVP help I now have a macro which recognises the date and time
and places a tab between date and time and between time and venue. I doubt
we shall ever be able to automatically put a tab between venue, meal and
speaker.
However it should be possible to put a manual line break ahead of whichever
comes first of Host, Contact, Cashier or Reception.
Then, I wonder if there is a way of replaceng the paragraph marks with a ",
" between each remaining item.
Taking the first event:
29.08.2006 13:00 University Arms Hotel Lunch (frugal) Mark
Oliver, The work of Cambridgeshire Trading Standards Department
Host: Ben Jupp
Cashier: Graeme Minto
Reception: Stan Webster and Ian Purdy
Would end up as:
29.08.2006 13:00 University Arms Hotel Lunch (frugal) Mark
Oliver, The work of Cambridgeshire Trading Standards Department
Host: Ben Jupp, Cashier: Graeme Minto, Reception: Stan Webster and Ian Purdy
Many thanks and apologies for this long winded posting - I suppose the
problem is that I am able to write a series of IF statements in this
situation. Maybe I shall have to try in XL
Francis Hookham
29.08.2006 13:00 University Arms Hotel Lunch (frugal) Mark
Oliver, The work of Cambridgeshire Trading Standards Department
Host: Ben Jupp
Cashier: Graeme Minto
Reception: Stan Webster and Ian Purdy
03.09.2006 Grafham Water RYLA Week RYLA - the Rotary Youth
Leadership Award at Graffham Water, 2-9 September, all welcome on Sunday,
3rd, to see what it is all about
Contact: Victor Bugg
05.09.2006 12:00 University Arm Hotel ISC meeting
International Service Committee meeting at the UAH in room to be advised
05.09.2006 13:00 University Arms Hotel Lunch meeting
Murray Morse, Editor Cambridge Evening News, Developments of the CEN
Host: Charles Hewitson
Cashier: John Grieve
Reception: Tony Newall
05.09.2006 18:15 CUP Council meeting Council Meeting at
CUP, Shaftesbury Rd. All members are welcome
10.09.2006 TBA Sunday Walk Put this date in your diary for the
Sunday Walk No. 4 to be arranged by Bernard - details later
Contact: Bernard Townshend
12.09.2006 07:45 University Arms Hotel Breakfast
Fellowship meeting
Cashier: Charles Hewitson
Reception: Jim Lamb Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90215
How can I set up Word to calculate a value and show it in a form?
Hello, I am working on a nursing shift turn over form. One of the things I
would like to do is set it up to calculate length of a baby. We enter in the
CM and in another block it automatically calculates the inches.
I have the CM box set as a number, and has a bookmark of Text36. Then my
next box is for inches. It is bookmarked Text37. I have it set as a
calculation. In the expression box I have = Text36 / 2.54. When I save out
of the Field Options box it does the calculation and puts the correct value
in there. When I protect the form and use it, no matter what I put in Text36
(the CM box) it doesnt change Text37 (the inches box.) Is there a way to do
this? Does someone know an example maybe that I could look at to get it to
work? Thank you so much for your time.
Andrew Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90202
Tabbing in Microsoft Word - Disabled Fields and VBA
Hi all
This is a query about tabbing in a protected Word Document (v2003), with
disabled controls.
In the word document there are OleControls. Some of these oleControls are
disabled so no text cannot be entered into them.
However whilst tabbing from an enabled field to a disabled field the cursor
gets "stuck", and cannot move from the disabled from by tabbing. The user
needs to use the mouse.
To work around this I have developed vba code to set the order of tabbing
like this.
Control 1 - Name : Customer
Control 1 - Type : textbox
Control 1 - State :enabled
Control 2 - Name : CustomerId
Control 2 - Type : textbox
Control 2 - State :disabled
Control 3 - Name : Address
Control 3 - Type : textbox
Control 3 - State :enabled
I have developed vba code to link a keydown event on the customer field to
the address field, if the key input is a tab key
private sub cusomer_keyDown(byval keyCode as MSforms.ReturnInteger, _
byval shift as integer)
if keyCode = VBA.vbKeyTab then
Address.select
End if
End sub
The problem is, most of the time this works, however on certain computers
with the same version of Word installed as mine, the tabbing does not follow
this order !
It seems to create a random order, and positions the oleControl on a
different textbox, one that was not specified in "tab-linking"
I have come to this discussion group to find if anybody has experienced the
same issue as this, and to look for a fix or a work around to this.
Thanks in advance
Joseph Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90201
how to print at least 1 cm of row before break
I need to insert a table and allow rows break across pages. but I want
to print at least 1 cm of each row before break and if empty space is
less than 1 cm complete rows breaks to other page in vba. Is there a
solution or not? Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90197
Code won't execute Main Macro Calls - non breaking spaces
Hi again Doug and Greg,
My MAIN MACRO does not execute the first 2 options DO FIND AND REPLACE. But
both syntax work in the Find and Replace window. The remainder of the MAIN
MACRO options execute.
Would appreciate if someone could point me in the right direction to fix
this. I would like to expand on my call routines but one step at a time.
Would really appreciate it.
TEST DATA:
20 June 2007
XXX 19 233 444 555
XXX 000 222 222
10 MAY 2006
13 JUNE 2006
13 may 2006
XXXX 123444
And this is a test sentence. This replace is just a test. Thank you for
helping? And that is that.
***MACROS***
Option Explicit
Sub DoFindReplace(FindText As String, ReplaceText As String, _
Optional bMatchWildCards As Boolean = False)
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = FindText
.Replacement.Text = ReplaceText
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
Do While .Execute
'Keep going until nothing found
.Execute Replace:=wdReplaceAll
Loop
'Free up some memory
ActiveDocument.UndoClear
End With
End Sub
'Call the macro:
Public Sub MainMacro()
'Replace spaces with non breaking spaces
Call DoFindReplace("([0-9]{1,2})([ADFJMNOS][A-Za-z]{2,})([0-9]{4})",
"\1^0160\2^0160\3^0160\4")
'Dates - replace spaces with non breaking spaces
Call
DoFindReplace(FindText:="([0-9]{1,2})(([0-9]{1,2})([ADFJMNOS][A-Za-z]{2,})([0-9]{4})",
ReplaceText:="\1^0160\2^0160\3", bMatchWildCards:=True)
'Remove double spaces TEST WORKS
Call DoFindReplace(" ", " ")
'Remove all double tabs TEST WORKS
Call DoFindReplace("^t^t", "^t")
'Remove empty paras (unless they follow a table or start or finish a
doc) TEST WORKS
Call DoFindReplace("^p^p", "^p")
End Sub Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90190
different tablestyle for each cell
I have a table with four columns. The content of each cells maybe willl
be too large that it will spread whitin more than one page. the Content
of one colums is important and I want to allow to break whtin the page
when the content is too long but the content of another columns is not
very important and I donot want to allow to break when the content is
to large.
What shall I do to solve my problems in vba please help Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90188
shell
How can i start from a shell command a new template of word?
Shell "Winword.exe",...and than? Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90184
non breaking space Word 2003
I have bookmark code to find non breaking space and convert. But how do I
set search string in Find - looking for serach string::
ASDN 12 123 123 123
19 July 2008 12 December 2007
So I can do find and replace all.
ActiveDocument.Bookmarks(1).Range.Find.Execute _
Findtext:=" ", _
ReplaceWith:="^s", _
Replace:=wdReplaceAll Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90174
Closing Excel files while exiting Word
Recently i received great help closing excel files while exiting excel. I now
needto be able to close excel files as I exit word. I have been given the
following code :
Private Sub Document_Close()
Dim pobjApp As Object
Do
On Error Resume Next
Set pobjApp = GetObject(, "Excel.Application")
On Error GoTo 0
If pobjApp Is Nothing Then
Exit Do
End If
Do Until pobjApp.Workbooks.Count = 0
'What goes here?
'I think I've tried everything?
Loop
pobjApp.Quit
Set pobjApp = Nothing
Loop
End Sub
thanks in anticipation
colt Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90172
Problem on closing application - Word 2000
I have finally put this application together, but am having trouble closing
every single document in the project. There always seems to be one open (the
actual template document I think, so that when the exit button is clicked to
close the application, the user is asked if he/she wants to save the document
- because I only have a userform visible, I don't want this message to appear
- I just want every document to close and then the application to quit
without any messages - I must be missing something, here's all the code ...
It consists of a blank template document coded, with links to two outer
files, pre-printed with some text, and bookmarked for text from the text
boxes. The checking of a box dictates which document is loaded.
Sub thisMacro()
'
' thisMacro Macro
' Macro created 15/08/2006
'
Application.Visible = False
UserForm1.Show
End Sub
Private Sub btnExit_Click()
Application.Quit
End Sub
Private Sub CommandButton1_Click()
If cbxDouble.Value = True Then
Documents.Open FileName:="C:\Documents and Settings\My Documents\double
sheet.doc"
With ActiveDocument
.Bookmarks("Text1").Range.InsertBefore tbxOne
.Bookmarks("Text2").Range.InsertBefore tbxOne
etc.............
Me.tbxOne.Text = ""
Me.tbxTwo.Text = ""
Me.tbxThree.Text = ""
Me.tbxFour.Text = ""
ActiveDocument.PrintOut
ActiveDocument.Close wdDoNotSaveChanges
Else
Documents.Open FileName:="C:\Documents and Settings\\My Documents\single
sheet.doc"
With ActiveDocument
.Bookmarks("Text106").Range.InsertBefore tbxThree
.Bookmarks("Text107").Range.InsertBefore tbxThree
etc............
End With
Me.tbxOne.Text = ""
Me.tbxTwo.Text = ""
Me.tbxThree.Text = ""
Me.tbxFour.Text = ""
ActiveDocument.PrintOut
ActiveDocument.Close wdDoNotSaveChanges
End If Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90169
Form Automation
I am currently in the processes of creating a monthly report for an
organization to fill out monthly , but I have run into a bit of a road
block. I am looking for a way to to have the following inputted into
my form when a user needs it:
Date and time of event: Program Length (hrs):
# in attendance: # of members in attendance:
Title of Program:
Types of publicity and area publicized:
Description of event:
Cosponsored with:
National Requirement? Select One
The problem is that since the number of programs changes every month I
want a way so they can click a button and a macro (or anything) would
create the above information below the previous entry. Also in the
text above I would like a form fields inserted where they answer each
of the questions. I would appreciate any help. Thanks. Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90167
Manipulating Strings
I am trying to take a long string (that is split up with 2 tab characters
and contained on the clipboad) and place it
into 3 variables.
From http://www.word.mvps.org/FAQs/MacrosVBA/ManipulateClipboard.htm
I have used the following code to place data from the clipboard into a
variable:
Dim MyData As DataObject
Dim strClip As String
Set MyData = New DataObject
MyData.GetFromClipboard
strClip = MyData.GetText
How would I manipulate strClip to place its contents into 3 variables, as
defined by the tab separation?
Any help would be appreciated.
TIA Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90160
Definition of 'ThisDocument'
Hi
Can anyone define what object the 'ThisDocument' is in the VBA editor screen?
In my case - my Word 2000 vba project is a template so is the 'ThisDocument'
object mentioned, the page that fronts the template and belongs with the
template?
If I am correct in my guess, can you open and close 'ThisDocument' as your
ActiveDocument, just like opening a document from another file to include it
as part of your project?
If correct what code would open and close 'ThisDocument' as ActiveDocument?
If I am wrong on all counts, just a simple definition of what 'ThisDocument'
is would suffice.
Thanks Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90156
Report formatting - Bulleted lists
I have four documents which make up the sections of a report we issue to a
client. I want to use VBA macros to control the formatting and make the
reports consistent.
I have created a macro which sets the bullet formatting for the selected
bullets (see below) and I have had some help from Jean-Guy Marcil, Helmut
Weber, and Doug Robbins, to come up with a maco that formats all the tables
in the document.
How would I edit my bullet formatting macro so that it is applied to all
bullet lists in the open document?
Sub fmtBulletAlignment()
'
' Clear all tab stops
' Add new tab stops for next/additional column
' Setup Bullet and text locations
Selection.ParagraphFormat.TabStops.ClearAll
Selection.ParagraphFormat.TabStops.Add
Position:=CentimetersToPoints(11.2 _
), Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
Selection.ParagraphFormat.TabStops.Add
Position:=CentimetersToPoints(2.2), _
Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
With Selection.ParagraphFormat
.LeftIndent = CentimetersToPoints(2.2)
.RightIndent = CentimetersToPoints(0)
.SpaceBefore = 3
.SpaceBeforeAuto = False
.SpaceAfter = 3
.SpaceAfterAuto = False
.LineSpacingRule = wdLineSpaceSingle
.Alignment = wdAlignParagraphLeft
.WidowControl = True
.KeepWithNext = False
.KeepTogether = False
.PageBreakBefore = False
.NoLineNumber = False
.Hyphenation = True
.FirstLineIndent = CentimetersToPoints(-0.75)
.OutlineLevel = wdOutlineLevelBodyText
.CharacterUnitLeftIndent = 0
.CharacterUnitRightIndent = 0
.CharacterUnitFirstLineIndent = 0
.LineUnitBefore = 0
.LineUnitAfter = 0
End With
End Sub
Regards
D Dawson Tag: How do I Word Macros from Office Professional in Office Basic? Tag: 90154