Findout the solution of my project
I'm using Visual Basic 6. I'm doing my project which is related with VB and
Word. I've designed One Button and Rich Text Box. (RunTime )Copy Word
Document contant and paste it in this RichTextBox. If you click this button
it should autometically saveas Word Document. It's working but the alignment
not in order. Could you please tell me what we are getting from our word
document it should appear on our document in the same manner Tag: ComboBox Tag: 76626
need help for hooking the selectcert dialogbox
Hi all
I am looking for tweaking the current behavior of Word when it comes to
apply a digital signature.
Actually a dialogbox pops up showing available certificates in my store when
applying following code in a macro
dim sig as signature
set sig = activedocument.signatures.add
'here the dialog box pops up and we select manually a certificate
'then to save the signature attached we need :
activedocument.signatures.commit
I would need to pass a time stamp (date) as parameter to tweak the digital
signature , I would like to hook in the select_cert_struct used to build the
listbox showing the certificates (Article on MSDN about selectcert function
as well) only with filtered certificates (signer name, certificate issuer and
expiration date)
I can't figure out how to proceed...
Any of you can help me ?
looking forward to hear from you soon I remain
regards Tag: ComboBox Tag: 76621
How to deselect floating text box
In Word 2000 I have a floating text box in a cell of an many-row table. I
am trying to create a macro that will delete the box, the paragraph mark
that it is anchored to, and the 3 blank paragraphs after it (all in the same
cell). "Selection.ShapeRange.Delete" will delete the text box, but the
cursor jumps to the top of the document. I tried some GoBack commands to
bring the cursor back to where the box had been but they don't always take
the cursor to the right location.
What I really want to do is start the macro with the text box already
selected by the user, then deselect the box and put the cursor immediately
in front of it so I can delete the paragraph containing it. What code do I
use to that is equivalent to "deselect the text box and put the cursor
immediately before the box"? ("Collapse" puts the cursor in front of the
text that is in the box, not before the box.)
TIA,
Vivian Tag: ComboBox Tag: 76615
Embed files in Word (OUTLOOK.Fileattach)
I have RTF files which have embedded ole objects whose classtype is
"Outlook.FileAttach". I've been trying to use the inlineshapes property in
the word object model. I can't do inlineshape.oleformat.object.saveas.
There is a Run-time error 430: Class does not support automation or does not
support expected interface.
My code works for other classtypes besides this. Is there a way around
these classtypes? Tag: ComboBox Tag: 76611
Convert slide object to jpg
I'm using "Send To Word" to get my slides and speaker notes to a Word
document for further editing and reformatting. The slides are sent as
"slide objects"; this results in an enormous Word file size. In
m.p.powerpoint I asked if there is a way to get "Send To Word" - or some
similar function - to send jpgs or some other image style.
My other option is to convert the slide objects, programmatically, to jpgs.
I tried the following:
Selection.InlineShapes(1).OLEFormat.ConvertTo ClassType:= "Paint.Picture",
DisplayAsIcon:=False
but I get "Run-time error 5360: The server application, source file, or item
cannot be found..."
Is there a way in vba (or other way) to convert the slide objects to
pictures?
BTW, my workaround is to use SnagIt to capture the image of the slide object
in the clipboard, delete the slide object, and paste the image in its place.
Tedious for long documents, however!
Thanks,
Bob Tag: ComboBox Tag: 76610
Show/hide large pieces of a document?
Hi,
Here's an interesting challenge... I was asked to create an application
that would let users choose paragraphs to show or hide using a checkbox.
The basic idea is that they would look at several alternate paragraphs per
page, choose one by checking its checkbox, and then generate the "final"
version of the document, which would hide the non-checked paragraphs on each
page. In some cases, entire pages could be shown or hidden with page-level
checkboxes in addition to the paragraph-level checkboxes (e.g., if a page is
checked, only show the paragraphs on that page that are also checked).
I don't know where to start on this one. I've fiddled around with bookmarks
and ranges, and neither seems to offer an easy answer. Can anyone offer any
good suggestions to make this a straightforward kind of project?
Thanks to anyone who can help...
...Jay Tag: ComboBox Tag: 76607
How to prevent the wdPaneComments pane from opening
I have a toolbar to add comments using:
Selection.Comments.Add Range:=Selection.Range
Selection.TypeText Text:=MyText
How do I prevent the wdPaneComments pane from opening.
The ActiveWindow.ActivePane.close, works but flashes the screen.
Please help. Thanks. Tag: ComboBox Tag: 76605
how do i add items in the drop down box using Visual basic?
HI all
Can anyone tell me how do i use vb to add items in the dropdown box as i am
making a form and using control toolbox to create a drop down.
please Help!!!!!!!!!!!! Tag: ComboBox Tag: 76596
Repost: PDF four versions of a document then delete interim saved Word files
I posted this the other day but it seems to have fallen off the radar
screens because of the weekend.
Thanks
Mike
So I'm working on this template and the client wants it to have the ability
to make PDFs of four different versions of the same document... basically
changing the logo to reflect the different businesses that are part of the
corporation. Okay, I've got that all set up. A couple things are challenging
me, though.
1. I've got a button the user can click to generate the four different PDFs.
In order to do so, I have to give the document a different file name for
each one, otherwise when I create the PDFs it would just overwrite the same
PDF file and I'd only end up with one. So I modify the filename and do a
"Save As..." and everything's cool.
However, I'm unable to pass the path to the Acrobat Distiller printer so I
have to have the user manually browse to the directory where the PDF files
should be saved.
Anyone know of a way I can programmatically pass the appropriate path to the
Acrobat Distiller print dialog? Of course, I'd rather not have to have the
Acrobat Distiller print dialog display at all but it doesn't seem there's a
way to just have it all happen under the hood. Any pointers would be
welcome.
2. Because I'm doing the "Save As...", I'm ending up with four separate .DOC
files. When I create the file I initially save it with a compound filename,
consisting of a filename string the user provides (I put up a dialog box
requiring the user to enter a filename) with a string representing the
initial logo. So, for example, the initial file might be named
"Document1-logo1.doc". When I go through the PDF process, I modify the
filename to reflect the change of the logo and do a "Save As...", ending up
with three other files... "Document1-logo2.doc", "Document1-logo3.doc" and
"Document1-logo4.doc". So the process is as follows:
*Create "Document1-logo1.doc"
*Print "Document1-logo1.doc" to Acrobat Distiller printer, yielding the
default filename of "Document1-logo1.pdf"
*Save as "Document1-logo2.doc"
*Print "Document1-logo2.doc" to Acrobat Distiller printer, yielding the
default filename of "Document1-logo2.pdf"
*Save as "Document1-logo3.doc"
*Print "Document1-logo3.doc" to Acrobat Distiller printer, yielding the
default filename of "Document1-logo3.pdf"
*Save as "Document1-logo4.doc"
*Print "Document1-logo4.doc" to Acrobat Distiller printer, yielding the
default filename of "Document1-logo4.pdf"
The client wants the process to end up with only the original file
("Document1-logo1.doc"), so I need to delete "Document1-logo2.doc",
"Document1-logo3.doc" and "Document1-logo4.doc". I store the fully-qualified
filenames that I've used as strings named "killfile1", "killfile2" and
"killfile3" but when I attempt to delete the files using the language "kill
killfile1" I get a "Runtime error '70', Permission denied". So it appears
that I've got the instruction correct but there's something that prevents me
from actually deleting the file.
So my second question is how do I avoid the "Runtime error '70', Permission
denied"? Or is there a way I can pass the preferred PDF filename and path
directly to the Acrobat Distiller printer driver so I never have to do a
"Save As..." to the Word document??
3. When I create the file initially, the filename I use is constructed from
user input (from the example above, the user would have typed "Document1" in
the dialog box I put up) with a representative logo string ("-logo1"). If,
at some point in the future, the user wants to revise the document, they'll
open "Document1-logo1.doc". Now I have a problem because I don't have a
user-entered string stored ("Document1"). So if they then click the PDF
button, they end up with:
"Document1-logo1.doc"
"Document1-logo1.pdf"
"Document1-logo1-logo2.doc"
"Document1-logo1-logo2.pdf"
"Document1-logo1-logo3.doc"
"Document1-logo1-logo3.pdf"
"Document1-logo1-logo4.doc"
"Document1-logo1-logo4.pdf"
And my file deletion code fails because it's never able to construct the
proper "killfile1", "killfile2" and "killfile3" strings.
<arggh>
Any suggestions??
Thanks
Mike
--
Mike Starr WriteStarr Information Services
Technical Writer - Online Help Developer - Technical Illustrator
Graphic Designer - Desktop Publisher - MS Office Expert
(262) 694-1028 - mike@writestarr.com - http://www.writestarr.com
--
--
Mike Starr WriteStarr Information Services
Technical Writer - Online Help Developer - Technical Illustrator
Graphic Designer - Desktop Publisher - MS Office Expert
(262) 694-1028 - mike@writestarr.com - http://www.writestarr.com Tag: ComboBox Tag: 76595
Word should have a temp file like cookies for unsaved documents.
I do IT support for NDSU. One of the people I was helping yesterday had her
laptop loose power. She didn't save her document and lost 15 pages she had
typed. If there was a stored temp file for each document typed something
like this could be retreved. It could save itself in a directory called temp
and label as doc0001, and the next doc0002. It could save over itself say
every 10 seconds.
----------------
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=d571a30f-a9b5-4a8e-81c3-d2822710b20d&dg=microsoft.public.word.vba.general Tag: ComboBox Tag: 76585
Programming Books for Word
Having just finished Powerful PowerPoint for Educators, I now want to learn
more about VBA for all of the MS Office applications by starting out with
learning VBA for MS Word. I am looking for a good book for a beginner who is
a step by step type of learner. The book needs to have examples and exercises
to do.
Thanks,
--
Bonnie Tag: ComboBox Tag: 76583
dialogue response
Hello everyone,
I have a word document that has a macro attached to it, inside the
macro i open a form and want to send the response (0 or 1) back to my
main module but i don't know how to do this. In vb.net you can say
openDialogue and then set the dialogueResponse which will hand the
response back to your main form.. i don't know how to do it in VBA...
can someone please help?
Thanks,
Erin Tag: ComboBox Tag: 76582
Browse for a specific path
Is there a way to capture a directory location for use later in a macro?
I'm looking for the ability to create a button similar to the MODIFY...
button on the File Locations tab of the Options dialog box. I will be the
only person who uses this code.
Basically, I want to create a UserForm that I will use to Save my documents
to 3 separate locations simultaneously.
I have a macro that does this already, but I can't change the locations for
different documents. I want to make it more flexible by giving myself the
option to override the default save locations.
Ultimately, I hope to use a naming convention to have documents with
specific prefixes save to specific directories, but I've got a lot of work
and learning to do to get there.
Thanks,
--
tj Tag: ComboBox Tag: 76573
Help: Overriding Words built-in-function
Hi there,
what is the MacroName for the function, found in the toolbar, to insert a
table and select the desired number of rows and columns by dragging the mouse?
I need to override that macro in order to set the checkbox .AllowAutoFit =
False (It is True by default) when a new table is created that way.
I have succeeded in overriding the Macro TableInsertTable in the desired
template. I can set
.AllowAutoFit = False which is the desired behaviour. It looks like this:
Sub TableInsertTable ()
With Dialogs(wdDialogTableInsertTable)
If .Show = -1 Then
Selection.Tables(1).AllowAutoFit = False
End If
End With
End Sub
TIA,
Peeter Tag: ComboBox Tag: 76572
Need macro to erase data when field is changed
I've a document with fields in a protected section and a table for approvals
in an unprotected section. When the 'Version' field is changed, I want some
of the cells in the approvals tables to be cleared. This is to prevent an
updated document slipping through without being re-approved. I'll also need a
message box to warn people what will happen if they play around with the
field.
I'm not very good with Word macros so your help is greatly appreciated.
--
Linda M Tag: ComboBox Tag: 76571
Works in 97 but not in 2003
The following macro works in 97 but not in 2003:
> Sub QuotesWf()
>
> ' QuotesWf Macro
> ' Macro recorded 08/14/02 by John Doue
>
> Selection.Find.ClearFormatting
> Selection.Find.Replacement.ClearFormatting
> With Selection.Find
> .Text = "^0147^0148<"
> .Replacement.Text = "^0171 "
> .Forward = True
> .Wrap = wdFindContinue
> .Format = False
> .MatchCase = False
> .MatchWholeWord = False
> .MatchWildcards = True
> .MatchSoundsLike = False
> .MatchAllWordForms = False
> End With
> Selection.Find.Execute Replace:=wdReplaceAll
> With Selection.Find
> .Text = ">^0147^0148"
> .Replacement.Text = " ^0187"
> .Forward = True
> .Wrap = wdFindContinue
> .Format = False
> .MatchCase = False
> .MatchWholeWord = False
> .MatchWildcards = True
> .MatchSoundsLike = False
> .MatchAllWordForms = False
> End With
> Selection.Find.Execute Replace:=wdReplaceAll
> End Sub
It replaces instances of open-close curly quotes by the appropriate
quote in French text (my TA software goofs here and I end-up, instead of
an open-quote French character at the beginning of a quote, with
open-close English curly characters).
Any idea how to solve the problem?
Thanks
--
John Doue Tag: ComboBox Tag: 76570
How to build a delay into a code
Hi
I'd like to pause a Winword macro until a specific time. I tried something
like
Application.Wait Now + TimeValue("00:00:10")
and it came with the compilation error "Method or data member not found".
Is it only for Excel?
Besides, this seems to be a busy wait which blocks the PC, which I have to
avoid, because it will run on a Terminal Server.
Why "Application.Wait" doesn't work and what is a better way to build a
delay in the code?
TIA
Alex Tag: ComboBox Tag: 76565
Append range to document
Hi,
I want to append the content of a range to a document, including all
formatting. The problem is I can't use the clipboard for this. Can this be
done and how?
Merijn Tag: ComboBox Tag: 76562
How to Fill the Labels in Mailling Label.
Hi,
i am using following code to fill the Conatct deatils in the
Labeles.
addr = "Dave Edson" & vbCr & "123 Skye St." _
& vbCr & "Our Town, WA 98004"
Application.MailingLabel.CreateNewDocument _
Name:="2160 mini", Address:=addr, ExtractAddress:=False
But it places Same Addrerss Details in all the Labels of the
Document.
But i have a set of Contact Details, Each Contact Details should go
to each Label.I really do not know how to Pass the Different contct
details...to each Label.
Can any one help me to do this.
Thanks in Advance,
Thiru
-------------------------------------------------------------------------
If you are not contributing to future, Future will not for you.... Tag: ComboBox Tag: 76559
Auto running of a macro
I have a macro to update all fields in a document. The fields come from the
file>properties section. What I want to happen is for the fields to update
(ie the macro to run) when the properties form is OK'd. Currently I can only
get it to work using the windowActivate event which means you have to select
another window first then select back again.
Is there an easy way to make this happen. If not is there a way I can create
a toolbar button that keeps with the template and doesnt disappear. (I have
already tried the button option but it keeps disappearing if I press the
button or if I open up a document from the template. The only way to make it
reappear is to go back to customise) Tag: ComboBox Tag: 76556
Programming Word Form Fields
I have created a document with form fields and have been trying to
unsuccessfully use the code in kb article 211219 to make the enter key behave
like the tab key. I also have an area where credit card info will be entered
and have set each number up as separate fields ie 16 as the client wishes to
show a line between each number. In this area I would like to have the user
type a number key and have the insertion point automatically move to the next
field. I am very familiar with MS Access and VBA, but am struggling with word
objects.
I am using Word 2003. Tag: ComboBox Tag: 76540
Protect Form
I created from using option button. I protected form. So I can only type the
filed information and select option button.
I placed this file on the server.
But other user can't select option button. totally protected. I only
protected from, so people can select option button.
From my computer, it's working, But if the file is pulled out from the other
computer, it's totally protect, people even can't select option button. Tag: ComboBox Tag: 76539
Disk is full error
I have a Word document which contains a macro to update the entire document,
which is connected to a toolbar button. The macro is as follows:
Sub UpdateDocument()
'
' Macro1 Macro
' Macro recorded 8/25/2005 by mark
'
Dim pRange As Word.Range
For Each pRange In ActiveDocument.StoryRanges
Do Until pRange Is Nothing
pRange.Fields.Update
Set pRange = pRange.NextStoryRange
Loop
Next
End Sub
When I run this macro it goes through the entire document, including the
headers and footers, and updates all of the fields. In this document all of
the headers are the same and I have a single fill-in field in the header in
the first section (it contains several sections, but the headers are all set
as "Same as Previous"). Therefore it asks me what I want to fill-in the
field with. Every once in awhile it will ask me twice, which I think is odd
because there is only one of these fields in the header. Then after I do
this I try to save and it gives me an error that the disk is full (which it
definitely is not). The error message is as follows:
The disk is full. Free some space on this drive, or save the document on
another disk. Try one or more of the following:
*Close any unneeded documents, programs, and windows.
*Save the document on another disk.
I have tried these solutions and it still doesn't save. Can anyone help me
with this?
Thank you in advance,
Mark64 Tag: ComboBox Tag: 76533
How to position multiple DOC windows
I am quite new to VBA, yet I'm hopefull that there is an easy way to
open and postion multiple word documents throughout a dual monitor
desktop (after a Word crash etc).
I'm working with 10 files covering 5 languages.
I'm thinking either by somehow 'remembering' the last displayed
position of each document, or maybe reading path/filenames and desired
position from a word table or text data file.
Please help... Tag: ComboBox Tag: 76527
Macro Question: Syntax Error (Long)
I previously posted this to the Microsoft Communities:
_____________________
When I open a previously saved file and cancel options to enter a new number
and form name, a debugging error message comes up (Run-time error â??4605â??).
When the "end" option within that dialog box is selected, my cursor is placed
within the header instead of in the document, and when I close out of the
header/footer toolbar, Iâ??m taken back to the document, but the entire
document is selected instead of me simply being within a certain cell or row.
This debugging error does not happen when the form is being created as
normal; this is only an issue when previously saved forms are opened to be
edited.
When the "debug" option within that dialog box is selected, I am taken into
the Visual Basic editor and show the following macro:
* * * * * *
Sub AutoOpen()
Selection.HomeKey Unit:=wdStory
Selection.WholeStory
Selection.Fields.Update
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Or
ActiveWindow.ActivePane.View.Type _
= wdMasterView Then
ActiveWindow.ActivePane.View.Type = wdPageView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
ActiveWindow.ActivePane.View.NextHeaderFooter
Selection.WholeStory
Selection.Fields.Update
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Selection.HomeKey Unit:=wdStory
End Sub
* * * * * *
The macro bombs out at â??ActiveWindow.ActivePane.View.NextHeaderFooter.â??
________________________________
The answer I received was to change the coding to this:
Sub AutoOpen()
Selection.HomeKey Unit:=wdStory
Selection.WholeStory
Selection.Fields.Update
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Or
ActiveWindow.ActivePane.View.Type _
= wdMasterView Then
ActiveWindow.ActivePane.View.Type = wdPageView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
On Error resume next
ActiveWindow.ActivePane.View.NextHeaderFooter
If err.number = 0 then
on error goto 0
Selection.WholeStory
Selection.Fields.Update
End iF
on error goto 0
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Selection.HomeKey Unit:=wdStory
End Sub
I did this, however, the new code works fine when functioning only with
Word, but when the code tries to execute via an Access macro, we receive a
â??Compile error: Syntax errorâ?? message. I believe the line
â??ActiveWindow.ActivePane.View.NextHeaderFooterâ?? generates this message.
This Word macro runs via a macro initialized by a â??buttonâ?? inside an Access
file. The Access macro is responsible for opening the Word document that
will be utilized. The Word document is not opened prior to running the
Access macro.
Any help would be greatly appreciated. Tag: ComboBox Tag: 76526
after using spell check from vb6 not close properly normal.dot
I am ussing spell check of word 2002 in our VB project. Its works fine when
running first time but 2nd time display a error message that error in your
'normal.dot' file, please give me solution on 'ansar_m@hotmail.com' or
'ansarmah@gmail.com'
my codes are
Private Sub Command1_Click()
Dim oWord As Object
Dim oTmpDoc As Object
Dim lOrigTop As Long
' Create a Word document object...
Set oWord = CreateObject("Word.Application")
Set oTmpDoc = oWord.Documents.Add
oWord.Visible = True
' Position Word off screen to avoid having document visible...
lOrigTop = oWord.Top
oWord.WindowState = 0
oWord.Top = -3000
' copy the contents of the text box to the clipboard
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Clipboard.Clear
Clipboard.SetText Text1.SelText
' Assign the text to the document and check spelling...
With oTmpDoc
.Content.Paste
.Activate
.CheckSpelling
' After user has made changes, use the clipboard to
' transfer the contents back to the text box
.Content.Copy
Text1.Text = Clipboard.GetText(vbCFText)
' Close the document and exit Word...
.Saved = True
.Close
End With
Set oTmpDoc = Nothing
oWord.Top = lOrigTop
oWord.quit
Set oWord = Nothing
End Sub Tag: ComboBox Tag: 76524
How macro can do printscrn of other application and paste in word
I am trying to create a macro in word to do a printscreen in toad and paste
it in word. Is it possible to get the events of toad application captured in
word macro.
Thanks Tag: ComboBox Tag: 76520
Change first space in each paragraph to a tab
Does anyone have a simple macro that will change the first space in
each paragraph to a tab? Greatly appreciate some help with this. Tag: ComboBox Tag: 76515
Automatically update field
Hello,
I have a document with several custom properties that we've added such as
'Client'.
Using VBA we prompt for the value of the custom property and update it using
ActiveDocument.CustomDocumentProperties("Client").Value = "Name"
This all works great and the new value for the custom property is saved.
However, the field in the document header linked to this custom property
does not get updated.
Is there any way to automatically update the field linked to this custom
property?
Right now the user has to edit the document and use "Update field" to update
the field with the new value for the custom property.
Thanks,
Russ Tag: ComboBox Tag: 76511
determine is text was typed in or pasted into a document
Is it possible to determine if the text in a document was pasted in from
another source or typed in letter by letter? I have a word document and I
want to find out if this person wrote it themselves or copy and pasted it
into the document. I'm thinking maybe a 3rd party software that could do
this or something...
Hopefully someone out there can point me in the right direction.
Thanks
Andy Tag: ComboBox Tag: 76508
You really need to improve both your auto correct feature....
How can you even consider that your auto-correct feature, or the thesaurus
are up to par if it does not include even the simplest of words such as
adelpated?
----------------
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=206a49cc-2053-4e7d-9835-a0269c6c4837&dg=microsoft.public.word.vba.general Tag: ComboBox Tag: 76507
Applying styles not working properly?
I'm writing a C# app that allows exporting to a Word doc. I figured out how
to create the paragraphs and tables, and setting styles works from the code
perspective. However, when I open the document none of the styles are
applied. For instance, instead of a paragraph being "Heading 1", it will be
"Normal + 16pt" and similar for everything else. The strange thing is that
if
I do exactly the same operations from JScript then it works fine. Does
anyone
know what's going on here?!?
JScript (works)
par = doc.Content.Paragraphs.Add();
par.Range.Text = "Heading";
par.Style = doc.Styles("Heading 1");
par.Range.InsertParagraphAfter();
C# (doesn't work)
par = this.doc.Content.Paragraphs.Add(ref OptionalParam);
par.set_Style(ref style);
par.Range.Text = text;
par.Range.InsertParagraphAfter(); Tag: ComboBox Tag: 76505
Jump from FormField to FormField
Hi.
I'm making a script that I want to jump from one formfield to the
next. Below is the code. How do I get this vbs code to jump to the
next FormField?
Set objWord = createobject("word.application")
objWord.visible = True
Set objDoc = objWord.Documents.Add("c:\mydoc.doc", false)
objDoc.FormFields("Text4").Result = "Some text"
objDoc.FormFields("Text4").Next.select
'The next line fails
objDoc.Selection.Result = "Text in the next FormField" Tag: ComboBox Tag: 76502
TOC to<>from ?
I have a large manual with several sections. Sections might contain
information about a subject, or directions (map) to a location, etc.
I would like to use the table of contents as a home base for a reader
to click to a page and then somehow go back to the table of contents
much as the <Back> button would on a web browser.
This is probably a simple question, but how can this be implemented?
I have selected Tools | Options | Edit and unchecked the Cntrl-Click
feature to enable a one click on an item in the TOC to go to the page.
How can it be enabled to go BACK to the TOC easily?
-Dale- Tag: ComboBox Tag: 76500
Control Word Document/ Current Instance from within Access
Hi all.
I am trying to customise Word for a particular template
( wanted to avoid macros in word )
I have 2 public variables:
Dim wrd As New Word.Application
Dim DC As Word.Document
which get initialised:
....
Set wrd = New Word.Application
Set DC = wrd.Documents.Add("C:\Temp\My.dot")
isPrepaired = HideAllToolbars(wrd, DC)
.....
the bottom function hides all the toolbars exept my own - fine so far
but when the user creates a new instance of word directly (through
normal.dot) as long as my document is still open, no commandbars are there
in that normal version of word :-((
I created a macro that re-enables all the available toolbars when closing my
document
so when my document is closed all is fine and word creates all the normal
commandbars.
Questions:
How can I catch only the currentInstance I created in access and apply my
hiding stuff only to that one ??
or
Do I have to create a macro in the global normal.dot to enable expicitely
toolbars when my document is open ?
(wanted to avoid stuff like that)
Many thanks for your help.
Gina
***
Function HideAllToolbars(curWRD As Word.Application, curDC As Word.Document)
Dim i As Integer
i = 1
curWRD.EnableCancelKey = wdCancelDisabled
curWRD.WindowState = wdWindowStateNormal
Do
curWRD.CommandBars(i).Enabled = False
i = i + 1
Loop While i <= (curWRD.CommandBars.Count)
curWRD.CommandBars.AdaptiveMenus = False
curWRD.CommandBars("Toolbar List").Enabled = False
curWRD.CommandBars("Rechnung").Enabled = True
curWRD.CommandBars("Rechnung").Visible = True
curWRD.EnableCancelKey = wdCancelInterrupt
End Function Tag: ComboBox Tag: 76482
Replace Dialog
Hi,
General question with WORD2000.
I have a search string for the word "degree" which is to be replaced with
the degree symbol followed by an F or C. Since the word "degree" may have
any combination of upper and lower case letters I have search strings
defined as:
-[Dd][Ee][Gg][Rr][Ee][Ee]>
-[Dd][Ee][Gg][Rr][Ee][Ee][Ss]>
[Dd][Ee][Gg][Rr][Ee][Ee]>
[Dd][Ee][Gg][Rr][Ee][Ee][Ss]>
Is there a better way to define the search strings?
I am using the EditReplace dialog since some "degree" words may not have to
be replaced.
Thanks in advance for any hints.
Jerry Bodoff Tag: ComboBox Tag: 76475
GetActiveWindow through automation
I have a Word 2002 template which has a routine to prevent the user from
saving the file, by removing Close, Save, Save as, and Exit menu items,
disabling the Save tool from the toolbar, and disabling the top-right 'X'
button in Word. It does this using the following code:
DeleteMenu GetSystemMenu(GetActiveWindow,False),6,1024
This works fine if I just double click the .dot to create a new file, but
when I open through automation, GetActiveWindow always returns 0 (zero), so
the X button is not disabled. Any ideas anyone? Tag: ComboBox Tag: 76474
Acessing Paragraph Lines?
Hi,
General question with WORD2000.
I converted some text to a 2 column table which has fixed column widths. If
the column 1 text starts with an alphabetic then columns 1 and 2 in that row
are merged. If the text wraps to more than 1 line I would like to be able
to retrieve each line and place a manual line break at the end of the line
(need this for other processing). The text font is a proportional font
(Arial) and is a given and cannot be changed. Is this possible to do?
I looked all over and cannot seem to find anything that would help. I seem
to remember there is a TextWidth function but it seems that it does not
exist in VBA.
Any hints or solutions would be greatly appreciated. If API's are needed
that is acceptable.
Thanks in advance for any help.
Jerry Bodoff Tag: ComboBox Tag: 76473
Runtimeerror 429 ActiveX component cannot create object
I wrote this to read the fileinformations from a power point
prensentation and put them in a table in a word document.
Anyway, I always get an error on opening the presentation (I marked the
line in the code)
Runtimeerror 429 ActiveX component cannot create object
Would be really pleased if someone could help.
Thx Ivonne
Sub AuslesenPowerPoint()
Application.DisplayAlerts = False
Dim file As String
Dim name As String
Dim thema As String
Dim kommentar As String
Dim appWD As PowerPoint.Application
file = Dir$("O:\Oper\PowerPoint\*.*", vbNormal)
While file <> ""
'On Error Resume Next
Set appWD = GetObject(, "PowerPoint.Application")
If Err.Number <> 0 Then
Err.Clear
Set appWD = CreateObject("PowerPoint.Application")
End If
appWD.Visible = True
'On Error GoTo fehlermeldung
Presentations.Open FileName:=("O:\Oper\PowerPoint\" & file),
ReadOnly:=msoFalse
name =
Presentations(file).BuiltInDocumentProperties("Title").Value
thema =
Presentations(file).BuiltInDocumentProperties("Subject").Value
kommentar =
Presentations(file).BuiltInDocumentProperties("Comments").Value
Documents("Oper1.htm").Tables(1).Select
Selection.InsertRows (1)
Selection.TypeText Text:=(name)
Selection.MoveRight
Selection.TypeText Text:=(kommentar)
file = Dir$()
Wend
Exit Sub
fehlermeldung: MsgBox (Err.Description & Err.Number)
End Sub Tag: ComboBox Tag: 76472
How to programatically select printer
When using WordObject.Document.Printout in VB how can I select a printer?
--
Regards
Tom Tag: ComboBox Tag: 76471
inner editing doc files
Is there an application or a plug that represents doc files in two panes so
that one pane shows the source doc file and another pane shows the resulting
representation as seen by the user? The analogy is to Dreamveawer where it is
possible to simultaneously work in both design and source views. Tag: ComboBox Tag: 76469
file save as macro in word
I need to create a macro in word that highlights the first sentence in a
document and then saves it to a directory using that sentence as the name.
Is that possible? The sentence will only be a 3 to 4 words at the most. Tag: ComboBox Tag: 76467
The order in which Global Templates are loaded?
Hi,
Could anyone tell me in what order Global Templates in the Startup folder
are loaded when Word first opens? I recall something about template loading
in reverse Alphabetical order but have not been able to find the article in
which I had read that. The reason that I am asking is that it seems that
Adobe is loading in Word and locking the toolbars collection, preventing
other toolbars and menus from being handled by other global templates. I
would greatly appreciate it if anyone could either confirm this or tell me
the order in which templates really do load into Word?
Thank you. Tag: ComboBox Tag: 76464
Last ActiveDocument during a New event
I need to know which document was the Active document when a particular
template is opened, that is during the 'New' event of the template.
Thanks,
Fred Tag: ComboBox Tag: 76463
Word email
I am creating a word doc in access 2003.
I wish to email this doc including filling in the "to" field.
But I would also like it to open in the mail editor for last minute editing
and not just be sent.
I tried the options.email in word but could find no place to include the to
property of the email.
Any help is appreciated.
Thanks
Len
Options.SendMailAttach = True
'ActiveDocument.SendMail
docWord.SendMail Tag: ComboBox Tag: 76453
determine which fonts used in Word doc
Y'all: I took some code posted here few years back and expanded it so
that I can highlight the characters in my Word document that are of
undesireable font type. This works but is SLOW. How can I determine
all font types used in a Word document without going through each
character?
russ
Public Sub BSLFontMark()
'Macro created by rwpatter
' Characters with incompatible font are highlighted in yellow.
Dim GoodFontList(39) As String
Dim FontName As String
Dim BSL_OK As Boolean
Dim NoBadFontFound As Boolean
Dim i As Integer
Dim V As Long, Y As Long, X As Long, Z As Long
Dim rngChar As Range
NoBadFontFound = True
'list of fonts that are allowed in BSL database
GoodFontList(1) = "Arial"
GoodFontList(2) = "Arial Black"
GoodFontList(3) = "Arial Narrow"
GoodFontList(4) = "Book Antiqua"
GoodFontList(5) = "Bookman Old Style"
GoodFontList(6) = "Century Gothic"
GoodFontList(7) = "Comic Sans MS"
GoodFontList(8) = "Courier New"
GoodFontList(9) = "Estrangelo Edessa"
GoodFontList(10) = "Franklin Gothic Medium"
GoodFontList(11) = "Garamond"
GoodFontList(12) = "Gautami"
GoodFontList(13) = "Georgia"
GoodFontList(14) = "Haettenschweiler"
GoodFontList(15) = "Impact"
GoodFontList(16) = "Latha"
GoodFontList(17) = "Lucida Console"
GoodFontList(18) = "Lucida Sans Unicode"
GoodFontList(19) = "Mangal"
GoodFontList(20) = "Math Ext"
GoodFontList(21) = "Monotype Corsiva"
GoodFontList(22) = "MS Outlook"
GoodFontList(23) = "MT Extra"
GoodFontList(24) = "Mv Boli"
GoodFontList(25) = "Platino Linotype"
GoodFontList(26) = "Raavi"
GoodFontList(27) = "Shruti"
GoodFontList(28) = "Sylfaen"
GoodFontList(29) = "Symbol"
GoodFontList(30) = "Tahoma"
GoodFontList(31) = "Times New Roman"
GoodFontList(32) = "Trebuchet MS"
GoodFontList(33) = "Trebuchet MS"
GoodFontList(34) = "Tunga"
GoodFontList(35) = "Verdana"
GoodFontList(36) = "Webdings"
GoodFontList(37) = "WingDings"
GoodFontList(38) = "Wingdings 2"
GoodFontList(39) = "Wingdings 3"
Y = 0
Z = 0
X = ActiveDocument.Characters.Count
' For-Next loop through every character
For Each rngChar In ActiveDocument.Characters
Y = Y + 1
FontName = rngChar.Font.Name
i = 1
BSL_OK = False
Do Until i = 40
If GoodFontList(i) = FontName Then
BSL_OK = True 'font is a BSL good font
End If
i = i + 1
Loop
If Not BSL_OK And FontName <> "" Then 'Fontname ""
rngChar.HighlightColorIndex = wdYellow
Z = Y 'marks last place a bad font found
V = V + 1 'keeps up with count of bad font chars found
NoBadFontFound = False
End If
StatusBar = Format((Y / X), "0%") 'display status in %
Next rngChar
Selection.SetRange Start:=Z, End:=Z
If NoBadFontFound Then
MsgBox "Congratulations, No BSL incompatible fonts found, document OK
for BSL entry."
Else
MsgBox V & " BSL font incompatible characters found!" & vbCrLf & vbCrLf
& "The text I have highlighted in Yellow is incompatible with the BSL.
Change font type."
End If
End Sub Tag: ComboBox Tag: 76452
How to catch CTRL + C
Hi all.
well well .... only problems
another cry for help with my template idea ....
how can I stop word from acting 'normal' when keypress
1. CTRL+A
2. CTRL+C
occurs. I would like to happen NOTHING after the keypress ... no selection
etc
Many thanks !!
Gina Tag: ComboBox Tag: 76449
Help on Macro and Drop Down Boxes
Here is the code I am trying to get work, can anyone help me? My
objective is the following:
>From the nine options in the dropdown box I would like only the last
item to run a macro. The macro is taking only part of a table (trying
to use bookmarks.) It will only take a hand full of cells, merge them,
delete the contents that was already there, and then add a text form
field with 50 characters. This is all to be done in a protected form in
MS Word 2003. I can get bits and pieces working but not the whole
thing as a whole. Please help me. My code is below. FYI: I am a
beginner in the visual basic.
Public Sub DropDown_Click()
With ActiveDocument.FormFields("DropDown1")
Select Case ActiveDocument.FormFields("DropDown1").Result
Case 0
'no selection, do nothing
Case 1
'no selection, do nothing
Case 2
'no selection, do nothing
Case 3
'no selection, do nothing
Case 4
'no selection, do nothing
Case 5
'no selection, do nothing
Case 6
'no selection, do nothing
Case 7
'no selection, do nothing
Case 8
'#8 Blind
Call MacroOne
End Select
End With
End Sub
=================================================
Sub MacroOne()
Selection.GoTo What:=wdGoToBookmark, Name:="LeftSide"
With ActiveDocument.Bookmarks
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
Selection.Cells.Merge
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Range.Cells(1).VerticalAlignment =
wdCellAlignVerticalCenter
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.FormFields.Add Range:=Selection.Range, Type:= _
wdFieldFormTextInput
Selection.PreviousField.Select
With Selection.FormFields(1)
.Name = "Text1"
.EntryMacro = ""
.ExitMacro = ""
.Enabled = True
.OwnHelp = False
.HelpText = ""
.OwnStatus = False
.StatusText = ""
With .TextInput
.EditType Type:=wdRegularText, Default:="", Format:=""
.Width = 50
End With
End With
End Sub Tag: ComboBox Tag: 76443
Can someone SHOW me how to make my macro REPEAT?
Hi! Can anybody tell me how to make a macro keep REPEATING until it reaches
the end of the list?
Here's my macro . . . it works fine, but it only executes 'once' and then
stops. I need it to KEEP repeating. Can anyone please SHOW me how to MODIFY
it so it does what I need?
Selection.TypeText Text:=""""
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=""""
Selection.MoveRight Unit:=wdCharacter, Count:=1
What I want to do . . .
I have a column of words (just 1 word on a line) and I need to put QUOTES
around each word
Example:
apple
orange
banana
becomes
"apple"
"orange"
"banana"
So we want the macro to go down the entire list of words, and keep
repeating, and then stop when it finally gets to the end.
If anyone can SHOW me how to MODIFY my original macro, I'll sure be grateful!
Thanks again.
Jim Tag: ComboBox Tag: 76440
Hi,
Is there a way to determine the difference between typing in a combobox and
changing it by using the drop-down? I can only find the change-event.
Hi again,
I just found out that the keypress-event is what I am looking for.
/ Ulf
"Ulf Nilsson" wrote:
> Hi,
> Is there a way to determine the difference between typing in a combobox and
> changing it by using the drop-down? I can only find the change-event.
>
> / Ulf