my computer shuted down before I save the Microsof word
my computer shuted down beofre I saved the microsoft word application when i
opened again the computer I didn't find what I wrote Tag: "Compile error in hidden module: AutoExec" Tag: 58334
Userform_Deactivate (or some other event)
In a Word 2000 macro, I've got a non-modal form. When the user clicks out
side the form (form loses focus), I'd like an event to fire that makes
changes to the form. I thought Userform_Deactivate would take care of this,
but it doesn't do anything. Nor does Userform_LostFocus (which isn't a real
event, as far as I can tell).
How can I get the behavior I want? Tag: "Compile error in hidden module: AutoExec" Tag: 58329
Setting Table Cell Margins/Padding to "Same as the Whole Table".
Word 2003
In a Table, using a macro, I am trying to set the cell margins/padding
back to the "default" value. This operation is accomplised manually
by:
Tables => Table Properties => Cell => Options => Cell Margins =>
checkbox: Same as the whole table. (which sets "cell padding")
I can do the inverse, customize the cell padding to explicit custom
values for the cell with, e.g., the following working vba code:
With Selection.Cells(1)
.TopPadding = InchesToPoints(0.05)
.BottomPadding = InchesToPoints(0.05)
.LeftPadding = InchesToPoints(0.05)
.RightPadding = InchesToPoints(0.05)
.WordWrap = True
.FitText = False
End With
which code was obtained by recording "keystrokes" (mouse clicks and
keystrokes).
If I then run a record-keystroke macro to remove the custom padding
from the cell I get only the last two lines of code (.WordWrap and
.FitText). The "TopPadding =", etc., statements are missing
altogether. But running this "remove" macro doesn't work. The
existing custom padding/margins in the selected cell remains.
Is there a VBA statement that will remove the custom padding from the
selected cell and set it to the value assigned for the entire table?
I've tried:
.TopPadding = Nothing
and
.TopPadding = -1
Neither work. If I write code to query the value, it returns -1, but
if I try to set it to -1 the error message says that the value to be
set must be between 0 and some positive number (I forget the exact
value).
Thanks,
Fred Holmes
I chose to post this under "Tables" rather than macros or VBA, and did
not cross-post. Hope I did it correctly. Tag: "Compile error in hidden module: AutoExec" Tag: 58327
Hide / Include sections
i have a SQL2000 table containing all of our clients services and current
prices. I would like to create a mail merge using this information, which is
easy enough to to. What i would like to know is, is there a way to hide or
remoce sections of the word document dependant on if a field value in the
table is true.
ie, if a client does not use the archiving service they will have a 0.00
value against that service, there for when running the ,mail merge i would
like the section in the word document to not be included in this clients
letter.
if its possibel can anybody explain how i should mark the different section
on the document and hoiw to hid / show them ? Tag: "Compile error in hidden module: AutoExec" Tag: 58322
If Statement wont "Then"
Hi Guys
I've written this code:
Sub CheckVal()
'
'CheckVal Macro written by Chris 25 October 2004 '
'Checks the value of the current balance
ActiveDocument.Tables(2).Cell(6, 4).Select
Selection.Find.ClearFormatting
With Selection.Find
.Text = "$*0.00"
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
End With
Selection.Find.Execute
If Selection.Find = True Then
Exit Sub
Else
Application.Run macroname:="formatit"
End If
End Sub
The "Exit Sub" bit can be a skip to another macro, as long as the "Then"
works. At the moment, it keeps skipping to the "Else" if I have the If set
to True - which seems to be the opposite of what should happen as the Find
event highlights exactly what it is supposed to. What will normally appear
in the selection is "$ 0.00" (extracted from an Access Database by
someone else's macro). I know it finds the cell value, but I can't figure
why it skips the "Then". Tag: "Compile error in hidden module: AutoExec" Tag: 58321
Error trapping
How do you trap error messages in Word VBA? I looked on the HELP for
an ONERROR command but could not find it. What is the correct way to
trap errors?
Steve Wylie Tag: "Compile error in hidden module: AutoExec" Tag: 58315
Creating a Drop Down List
I am not an advanced user and I cannot find out how to create a drop down
list. I have a list of 16 items from which I need to be able to choose one
item. How do I do this? Thanks in advance. Tag: "Compile error in hidden module: AutoExec" Tag: 58311
How do I free memory in a Macro
I use macro to process approximately 30mbs of .doc word document. I would
like to free all memory my macro use in one loop, how may I do that? Tag: "Compile error in hidden module: AutoExec" Tag: 58309
Pulling sentences in a menu from a text file - please any ideas !
HI I have a little question that I would very much like some help with
I have a toolbar in word and when moving the mouse over a button I hav
some sentences that I can insert into the document. The are made wit
macros that are recorded but I would like to update this and add mor
without having to add these from/in the vba.
When I click a sentence in one languge the sentence is inserted i
English in my word document. If I move my cursor over the sentence thi
is translated with the comment.
What I would like is to pulle these macros from a text file o
something and be able to add more sentence in a nice and easy way.
This is the macro I use for inserting a sentence with comment:
------------------------------------------------------
Sub DendanskeambassadeiWashington()
'
' DendanskeambassadeiWashington Makro
' Makro indspillet 27-01-2004 af
' "&chr(10)&"lgr
'
Selection.TypeText Text:= _
"The Danish Embassy in Washington has recommended that w
contact you. "
Selection.Comments.Add Range:=Selection.Range
Selection.TypeText Text:="Den danske ambassade i Washington ha
anbefalet, at vi kontakter Dem."
ActiveWindow.ActivePane.Close
End Sub
____________________________________________
When I start on a letter there are a guide (form) where I can inser
data on who the letter is for and so on and when clicking ok the dat
is inserted. I have made it so that I can write these data in a tex
file and read them everytime the document is run. I belive that this i
a little like what I have to make for the pulling of the buttons a dat
or perhaps I am wrong.
This is what I use for reading data to my starting data screen where
can insert the data and the data from the text file is loaded.
-------------------------------------------------
Private Sub UserForm_Activate()
Dim iLin As Integer ' a counter for lines
Dim sTxt As String ' the text from a line
Open "c:\easyletters\config.txt" For Input As #1
For iLin = 1 To 2 ' in case there are 5 lines
Input #1, sTxt ' get the text from the line
' MsgBox sTxt ' for testing
Input #1, sTxt
txtafsendernavn.Text = sTxt
Input #1, sTxt
txtafsenderadresse.Text = sTxt
Input #1, sTxt
txtafsenderpostby.Text = sTxt
Input #1, sTxt
txtafsenderland.Text = sTxt
Input #1, sTxt
txtafsendertlf.Text = sTxt
Input #1, sTxt
txtafsenderfax.Text = sTxt
Input #1, sTxt
txtafsenderemail.Text = sTxt
Input #1, sTxt
txtafsenderwww.Text = sTxt
Input #1, sTxt
txtvoresref.Text = sTxt
Input #1, sTxt
txtnavn.Text = sTxt
Input #1, sTxt
cbostilling.Text = sTxt
Next
' or
'Input #1, sTxt
'TextBox2.Text = sTxt
'...
Close #1
End Sub
---------------------------------------------------
Hope U understand what I mean !
Any help would make me so happy :-)
Kind Regards
Lars Gravese
--
Message posted from http://www.ExcelForum.com Tag: "Compile error in hidden module: AutoExec" Tag: 58308
the auto-complete spelling function
the auto-complete spelling function should not change the case of letters
already typed.
Example: I have the word "jurisdiction" in my auto complete spelling list.
If I use the word at the begining of a sentence I will start typing
"Juris..." and the auto complete will let me hit "enter" and finish the word
for me, BUT it also changes the case back to lower case instead of how I just
had it.
How your program is writen now, someone has to enter two words into the
auto list for every word they might use to start a sentence with! Tag: "Compile error in hidden module: AutoExec" Tag: 58304
VBA Script to automatically run after document opens
I want to code a script to run immediately after a document opens similar to
workbook_open() in excel Tag: "Compile error in hidden module: AutoExec" Tag: 58303
word 2000 vba filesystemobject help file
When programming in VBA and trying to get help on the filesystemobject and
its associated methods highlighting a term and pressing F1 results in the
Visual basic Help window being opened but no content. If a standard vba term
is highlighted and F1 pressed the correct part of the visual basic help file
is displayed in the Visual basic Help window.
I have found the correct compiled help file VBLR6.CHM and can open it
directly.
How can I get the context editor to open the VBLR6.CHM as the help file?
--
Alan Cameron Tag: "Compile error in hidden module: AutoExec" Tag: 58301
Spelling Errors
Hi
I am trying to get all the spelling errors through macro from document. It
is not working perfectly. I executed the macro for a file which is of BIGGER
size. There are atleast 1000 spelling errors in that.
But, i am getting only few errors. Please advice.
The code is as follows:
Sub GetSpellingErrors()
ActiveDocument.SpellingChecked = False
Selection.WholeStory
Selection.LanguageID = wdEnglishUK
Selection.HomeKey unit:=wdStory
Open "c:\windows\desktop\out.txt" For Output As #1
For i = 1 To ActiveDocument.SpellingErrors.Count
print #1, ActiveDocument.SpellingErrors(i).Text
Next i
Close #1
End Sub Tag: "Compile error in hidden module: AutoExec" Tag: 58297
Spelling Errors
Hi
I am trying to get all the spelling errors through macro from document. It
is not working perfectly. I executed the macro for a file which is of BIGGER
size. There are atleast 1000 spelling errors in that.
But, i am getting only few errors. Please advice.
The code is as follows:
Sub GetSpellingErrors()
ActiveDocument.SpellingChecked = False
Selection.WholeStory
Selection.LanguageID = wdEnglishUK
Selection.HomeKey unit:=wdStory
Open "c:\windows\desktop\out.txt" For Output As #1
For i = 1 To ActiveDocument.SpellingErrors.Count
print #1, ActiveDocument.SpellingErrors(i).Text
Next i
Close #1
End Sub Tag: "Compile error in hidden module: AutoExec" Tag: 58296
Spelling Errors
Hi
I am trying to get all the spelling errors through macro from
document. It is not working perfectly. I executed the macro for a file
which is of BIGGER size. There are atleast 1000 spelling errors in
that.
But, i am getting only few errors. Please advice.
The code is as follows:
Sub GetSpellingErrors()
ActiveDocument.SpellingChecked = False
Selection.WholeStory
Selection.LanguageID = wdEnglishUK
Selection.HomeKey unit:=wdStory
Open "c:\windows\desktop\out.txt" For Output As #1
For i = 1 To ActiveDocument.SpellingErrors.Count
print #1, ActiveDocument.SpellingErrors(i).Text
Next i
Close #1
End Sub
-Ravi Tag: "Compile error in hidden module: AutoExec" Tag: 58295
Spelling and Errors
Hi
I am trying to get all the spelling errors from document. I am executing
below macro for 20-30 pages word file. There are atleast 1000 spelling errors
in that. But, I am getting only very few through macro. Please advice.
The code is as follows:
Sub GetSpellingErs()
ActiveDocument.SpellingChecked = False
Selection.WholeStory
Selection.LanguageID = wdEnglishUK
Selection.HomeKey unit:=wdStory
Open "c:\Output.txt" For Output As #1
For i = 1 To ActiveDocument.SpellingErrors.Count
print #1, ActiveDocument.SpellingErrors(i).Text
Next i
close #1
End Sub Tag: "Compile error in hidden module: AutoExec" Tag: 58294
?check if chapter contains hyperlink, if not, delete
Hallo Champs
I am getting mad on the following:
Is it possible to check a value between two or more headlines (changing headline, about 100 in the document) and if the desired content does not exist = delete all between
Sample:
Should look like:
=================
Headline
anyword anyword
anyword anyword anyword anyword
URL
Headline
...
WHEN:
there is no URL or description between headline and url, the complete paragraph should be deleted
Is that possible?
Notice:
Must use wildcarts
Styles in use are
Headline=H1
Text=Normal
URL=Hyperlink
Thx for any hint
*****************************************
* This message was posted via http://www.officekb.com
*
* Report spam or abuse by clicking the following URL:
* http://www.officekb.com/Uwe/Abuse.aspx?aid=87333c7b0f4a4656bf84dd541bffccd5
***************************************** Tag: "Compile error in hidden module: AutoExec" Tag: 58293
how to sort an array of strings?
Hello group,
Beginner here with 2 questions.
1. I have an array of strings which are word document names. Is there
a built-in function in word vba that I can use to sort them
alphabetically?
2. If I have an array of strings, say ("Mon" "Tue" "Wed" "Thu") and I
have an item, say "Wed" which belongs to that array. Is there a
built-in function to determine the index of this item in the array?
(in this case it should return 2).
Thanks very much for your help.
-wcc Tag: "Compile error in hidden module: AutoExec" Tag: 58291
How can I save a Word doc as an JPEG? Changes when saved as HTML.
I am trying to save a Word doc as an HTML but get a lot of reformatting when
I "save as". Is there an alternate method of saving, such as a jpeg or
something so I don't lose the formatting when I save to HTML?
Thank you in advance for your assistance!
Donna Tag: "Compile error in hidden module: AutoExec" Tag: 58290
DataObject type -- User Type undefined
I just discovered the trick I needed to solve this problem I had
trying to use the method "MyData.PutInClipboard"
1.Trying to follow the advice I got from an earlier thread
"You need to ensure that a reference is set to the Microsoft
Forms 2.0
library in Tools References in the VBA editor. This reference is
automatically set if you include a UserForm within your project."
wasn't successful, because the Microsoft Forms 2.0 library DIDN'T
APPEAR in the list.
2. then I tried putting a textbox on the form, because that was in the
Example. Again, the DataObject type was flagged as "undefined".
3. Ah! but here's the trick. Having put the textbox on, then taken
it off the form, now suddenly the Microsoft Forms 2.0 library appeared
on the list, I checked it, closed the dialog, and the macro now
worked! Doing both was the secret.
Greatly relieved! Hope this helps someone.
JSC Tag: "Compile error in hidden module: AutoExec" Tag: 58289
String width in specified font/size when merging
Hello,
I am merging documents with fields from an Excel sheet.
I need to put some text (from Excel) into boxes pre-printed on the paper,
the boxes have fixed sizes.
The problem is that some datas in the Excel sheet doesn't fit in the boxes,
and because I am using non-fixed fonts the values of the datas are changing
the width of the text (MMMMM vs IIIII).
My goal is to do a macro (in Excel or Word) to tell me which records doesn't
fit in a XX centimeters box when using a specific font/size (and then I can
modify manually the datas in Excel when it's too large).
I searched how to get the real printed width (or any value with a fixed
ratio value/real_printed_width) of a string but I can't find any information
about it.
Thank you VERY VERY much in advance, ANY help is REALLY appreciated.
Seb.
PS: sorry for my bad English, it is not my first language. Tag: "Compile error in hidden module: AutoExec" Tag: 58288
Obtaining "Save as type" (user input) value from Save As Dialog Bo
I want to ensure that the user does NOT select any other "Save as type"
other than "Word Document *.doc", to ensure that the macros are
retained in the file. So..........
I am displaying the Save As Dialog Box.
I thought I would interpret what "Save as type" the user has selected, and in
the case of them selecting anything other than "Word Document *.doc" generate
an error message box, and then NOT execute the Save dialog.
I thought that the property "Dialogs(wdDialogFileSaveAs).Format" would
return the user selection, but it does not.
What property or method can I use to obtain the user selected "Save as type"?
Or - if there's a better way to ensure that an original Word document is
always
saved as a "Word Document *.doc" regardless of name and/or location, I
would enjoy hearing about those options as well.
Thanks in advance! Tag: "Compile error in hidden module: AutoExec" Tag: 58286
VBA code or macro to list all settings in a Word template
Hello --
Does anyone know where I can find code or a macro to recap all the settings
I have made in a Word template (or, document) ?
I searched on "vba settings template" and found nothing.
Thanks for any help.
Larry Mehl Tag: "Compile error in hidden module: AutoExec" Tag: 58285
Reminder/Meeting version/format
Hi all.
I use VB6 to add reminders and set meetings in outlook:
Set olApp = CreateObject("Outlook.Application")
Set objMeet = olApp.CreateItem(1) '1=olAppointmentItem
In the code I use :
objMeet.OptionalAttendees = strEmails
I have two machines, one with Outlook2000 and the other with Outlook XP.
When I run this code on the machine that has Outlook 2000, the machine with
Outlook XP gets the invitation correctly (I can see its a meeting
invitation, I can accept/reject etc.).
When I run this code on the machine that has Outlook XP, the machine with
Outlook 2000 gets the invitation as a message with unclear text.
Can I force the code to send the invitation in a low version format (i.e.
Outlook 97). ?
Please advise.
Guy Tag: "Compile error in hidden module: AutoExec" Tag: 58284
Hlp Pls: Search & Replace makro results in funny styles
Hello,
I am using a recorded makro to earch and replace for some txt which then is
formatted to H1 - when do the commands manually it works fine, when I use the
makro where multiple operations are running the H1 style is apllied but with
boarders around it.
I dd not define any borders, not in the makro, nor in the makro or replace
function.
Any Idea?
Extract of the piece of (using the code stannalone work, using with other
operations in advanced does not work):
===================================
' reformats the main categories and adds a manual page break in front of
each
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Style = ActiveDocument.Styles("Heading 1")
Selection.Find.Replacement.ParagraphFormat.Borders.Shadow = False
With Selection.Find
.Text = "(= )([!^13]@) \=(^13)"
.Replacement.Text = "^m\2 "
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
===================================
This is the complete code - when running this, I get a box arund the headline
===================================
Sub Macro1()
'
' Macro2 Macro
' Macro recorded 10/23/2004
'
' delete txt index at first/second page
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "*= "
.Replacement.Text = "= "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
With Selection
If .Find.Forward = True Then
.Collapse Direction:=wdCollapseStart
Else
.Collapse Direction:=wdCollapseEnd
End If
.Find.Execute Replace:=wdReplaceOne
If .Find.Forward = True Then
.Collapse Direction:=wdCollapseEnd
Else
.Collapse Direction:=wdCollapseStart
End If
.Find.Execute
End With
Selection.HomeKey Unit:=wdStory
' replace com / col with communication / collaboration
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "= Com / Col ="
.Replacement.Text = "= Communication / Collaboration ="
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
' replace Desktop OS with Desktop Operating System
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "= Desktop OS ="
.Replacement.Text = "= Desktop Operating System ="
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
' replace Server OS with Server Operating System
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "= Server OS ="
.Replacement.Text = "= Server Operating System ="
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
' reformats the main categories and adds a manual page break in front of
each
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Style = ActiveDocument.Styles("Heading 1")
Selection.Find.Replacement.ParagraphFormat.Borders.Shadow = False
With Selection.Find
.Text = "(= )([!^13]@) \=(^13)"
.Replacement.Text = "^m\2 "
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
=================================== Tag: "Compile error in hidden module: AutoExec" Tag: 58283
Document.Close New instance of Template
I have a word template that uses a macro to open another word document, fills
in some variables, and then is supposed to close the "new" instance of the
template w/o saving (I need a template for my purposes which I won't get
into). When I try to use ThisDocument.Close, nothing happens.
Is there a reason ThisDocument.Close doesn't work on a new instance of a
template or am I doing something wrong? I know that ThisDocument.Close works
on a non-template file and also work when I "open" the template instead of
using "new".
This is probably an old question, but my search was unsuccessful. Tag: "Compile error in hidden module: AutoExec" Tag: 58278
How do I create a calculated due date (from current date) in word.
I have the current date at the top of my letter, in the body I want to
calculate the current date to the second date as 90 days due. Thanks. Tag: "Compile error in hidden module: AutoExec" Tag: 58276
Copying fields from headers
Sorry if this question has been asked before, but I searched through this
newsgroup and found different variations but not quite....
I have 2 documents and am trying to create a 3rd from the first 2. 1st
document has a header with some fields and text (like page number, date and
company info) followed by the content, and 2nd document just has content (no
header). I create the 3rd document by inserting second document at the end of
the first and saving it as the 3rd document. However, I can't seem to get the
fields of the header from the first document into the 3rd document.
Doing the following:
Dim Text As String = objDocument1.Sections(1).Headers(1).Range.Text
objDocument3.Sections(1).Headers(1).Range.Text = Text
only copies the text, and the field values are copied as text from the first
document, so on all pages, I get 1 of 1 ({PageNumber} of {NumPages}).
Is there a way I can copy the field like PageNumber and Date over to the 3rd
document and then update them?
I need to do the update after the 3rd document is created, since I need the
header on the pages of the 2nd document as well.
TIA,
Usha
Here is the code:
Dim myApp As Word.Application = New Word.Application
myApp.Application.Visible = False
Dim objDocument1 As Word.Document =
myApp.Documents.Open("c:\doc1.doc", ReadOnly:=True)
With myApp.Selection.Find
.ClearFormatting()
.Text = "<!firstname!>"
With .Replacement
.ClearFormatting()
.Text = "Usha"
End With
.Execute(Replace:=Word.WdReplace.wdReplaceAll)
End With
With myApp.Selection.Find
.ClearFormatting()
.Text = "<!lastname!>"
With .Replacement
.ClearFormatting()
.Text = "Vas"
End With
.Execute(Replace:=Word.WdReplace.wdReplaceAll)
End With
Dim objDocument3 As Word.Document = myApp.Documents.Add()
Dim Range1 As Word.Range = objDocument1.Range.FormattedText
Dim Range3 As Word.Range = objDocument3.Range
Dim Selection3 As Word.Selection = objDocument3.ActiveWindow.Selection
Range3.Collapse(Word.WdCollapseDirection.wdCollapseEnd)
Range3.FormattedText = Range1.FormattedText
Range3.Collapse(Word.WdCollapseDirection.wdCollapseEnd)
Selection3.EndOf(Unit:=Word.WdUnits.wdStory,
Extend:=Word.WdMovementType.wdMove)
With Selection3
.InsertBreak(Type:=Word.WdBreakType.wdSectionBreakNextPage)
.InsertFile(FileName:="c:\doc2.doc", ConfirmConversions:=False)
.Collapse(Direction:=Word.WdCollapseDirection.wdCollapseEnd)
End With
Dim Text As String = objDocument1.Sections(1).Headers(1).Range.Text
objDocument3.Sections(1).Headers(1).Range.Text = Text
objDocument3.SaveAs("c:\Development\PreAuth\docs\doc3.doc")
objDocument1.Close(Word.WdSaveOptions.wdDoNotSaveChanges)
objDocument3.Close()
objDocument1 = Nothing
objDocument3 = Nothing
myApp = Nothing Tag: "Compile error in hidden module: AutoExec" Tag: 58274
Problem with digitaly signed VBProject
Hi all,
I have a template with digitally signed VBProject. The problem is that the
second statement in the sub fails. I had noticed that if "Normal.dot" also
digitally signed the problem disappears. But signing "Normal.dot" for certain
reasons is unacceptable.
The possible solution could be to make Word to create embedded Microsoft
Word Document based on digitally signed template altered from "Normal.dot".
But I didnâ??t found the way to do it still.
Security level: high
Trust all installed add-ins and templates: unchecked
Sub CreateDocument()
Dim doc As Document
Selection.InlineShapes.AddOLEObject ClassType:="Word.Document.8", _
FileName :="", LinkToFile:=False, DisplayAsIcon:=True,
IconFileName:= _
"iwb3.ico", IconIndex:=0, IconLabel:=""
Set doc = ActiveDocument.InlineShapes(1).OLEFormat.Object
End Sub Tag: "Compile error in hidden module: AutoExec" Tag: 58270
include worksheets in word for similar documents
Word should include the ability for users to insert multiple documents in
worksheets just like Excel. This would allow similar documents to be grouped
together in one file, rather than having multiple open files. Tag: "Compile error in hidden module: AutoExec" Tag: 58263
Organizing Macros
Word 2003
I have too many macros in normal.dot. I'd like to split my macros
into specific sets, and store each set in some new/different "Global
template" so that I can select just one set to display using the
"Macros In:" list in the "Macros" (Alt-F8) dialog.
How do I create a new "global template" (or whatever convenient file
to store a macro set in)?
I don't want to store the macros in individual data (.doc) files.
I use the term "Global Template" above because I obseve that Adobe
Acrobat has, when installed, created its own global template with all
of the macros that it has added to my instance of Word.
Thanks for your help.
Fred Holmes Tag: "Compile error in hidden module: AutoExec" Tag: 58262
Copying the formatted text between two fields?
I would like to take the formatted text between two fields and place it into
another document.
So far, writing something like this:
theRangeSource = theFirstField.Result
theRangeSource.Collapse(Word.WdCollapseDirection.wdCollapseEnd)
theRangeSource.End = theSecondField.Result.Start
theRangeDestination.FormattedText = theRangeSource.FormattedText
does *not* work correctly. I get bits of the field codes copied into the
second document.
I would either like all formatted text *between* the two fields, or all
formatted text *including* the two fields placed into my second document
(theRangeDestination).
Note: I cannot use the application "Selection" as this is "unsafe" for the
purposes of running my reporter in the background while people are possibly
working with word in the foreground.
How can I do this?
Thanks
Robin Tag: "Compile error in hidden module: AutoExec" Tag: 58261
Can you use VBA to create a pie chart in Word
I have a Word table that gets populated with figures.
Is there VBA code that I can write that automatically creates a pie chart
when data is entered into the table.
Thanks Tag: "Compile error in hidden module: AutoExec" Tag: 58259
wdDialogEditAutoText
Hi, I was hoping someone could help me out. These are the arguments for
wddialogeditautotext: Name, Context, InsertAs, Insert, Add, Define,
InsertAsText, Delete, and CompleteAT
So which argument would I use to set the template to a specific template of
my choosing when calling the command wddialogeditautotext in a vba program?
Thanks for any help?
--
-Kirsten Tag: "Compile error in hidden module: AutoExec" Tag: 58258
page header to be actual header of paragraph of each page
Hi there,
we would like to have the name of the paragraphs header of the actual
page as the page header.
e.g:
page 1: paragraph header: Introduction
pager header left hand side: Introduction
page 2: paragraph header: Characteristics
pager header left hand side: Characteristics
In case there are two paragraph headers on one page we would like to
have the first one as the page header.
In case there is no paragraph header on the page we would like to have
the header of the previous page as the page header.
Can this be done?
Thank you very much.
Regards,
Norbert + Warren Tag: "Compile error in hidden module: AutoExec" Tag: 58247
Expand comment scope
Hi all,
is there any way to expand the comment scope range with VBA? Comment.Scope
property is read-only :(
Thanks
Marco Tag: "Compile error in hidden module: AutoExec" Tag: 58245
macro for spaces needed
have a peculiar problem happening with a document. When
it converts to rtf (from another format, not important),
it is producing lots of extra spaces between words.
Curious if anyone can provide a simple macro text that
will search through the document for more than one space
sections and replace them with single spaces. Would help
greatly. Thanks.
Boris Tag: "Compile error in hidden module: AutoExec" Tag: 58242
Smart Tags add Outlook Address
I would like to include two additional fields with the basic mailing address
used with Smart Tags in Word 2003 from Outlook. The fields for Company and
Job Title should also be included with the Smart Tag. How can I do that? Do
I have to purchase third-party software? Thanks in advance. Tag: "Compile error in hidden module: AutoExec" Tag: 58241
How to delete text between { }
Hi There,
Would you please let me know how to delete a text between {}?
Thanks,
Leila Tag: "Compile error in hidden module: AutoExec" Tag: 58237
Help with App.FileSearch object, please?
I'm trying to loop through the files in a folder to use FileCopy. The files
have no dot-extension suffix, and FIleSearch can't see them. If I rename
them with a .doc, it works great. Can someone help me tweak this? Or give
me a better method?
Ed
With fs
.LookIn = strPath & "\MyDocs"
.FileName = "*.doc" 'for no extension,
'I used "*"
If .Execute > 0 Then 'with no extension,
'this drops immediately to End If
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
strName = .FoundFiles(i)
strFName = Right(strName, Len(strName) - 9)
MsgBox strFName
FileCopy strName, strFolder & strFName
Next i
End If
End With Tag: "Compile error in hidden module: AutoExec" Tag: 58233
can anyone see what's wrong with this ?
can anyone see what's wrong with this
it spose to iterate through all picture objects & cut n paste them back
it errors on the very first picture (item(1)) it finds
With ActiveDocument
If .Shapes.Count > 0 Then
With .Shapes
For x = 1 To .Count
.Item(x).Select
Selection.Cut
Selection.PasteAndFormat (wdPasteDefault) <<<<<<<<<<<
error here (on item 1)
Next
End With
End If
If .InlineShapes.Count > 0 Then
With .InlineShapes
For x = 1 To .Count
.Item(x).Select
Selection.Cut
Selection.PasteAndFormat (wdPasteDefault)
Next
End With
End If
End With Tag: "Compile error in hidden module: AutoExec" Tag: 58231
Mail merge from Excel to Word
Hi,
I am trying to figure out how to right the code to perform a mail merge from
excel to a word file. The excel source is about 20 columns and the number of
rows will vary. Each item will be on a separate row with each column
representing information about that item. I would like each item to be on
it's own page in the word document. I was thinking of creating a word
template that would be a starting point and then doing a catalog type merge.
any help with the code, especially the new page for each row of data would be
appreciated.
Thanks,
Mike Tag: "Compile error in hidden module: AutoExec" Tag: 58230
wavy underlined content
Can I access just the wavy underlined words in word grammar errors through a
(visual basic) macro? Tag: "Compile error in hidden module: AutoExec" Tag: 58229
Selection Object
Hello,
I create a word document from vb application. I format the
header and footer and insert a couple of files into the
word documment. I use the selection object for both
formatting header and footer and inserting files. It works
fine the first time I run the program. But the second
time when I run it. The files did not inserted into the
document.
Here is the code I use to format footer:
objWord.Sections(1).Footers
(wdHeaderFooterPrimary).Range.Fields.Add
Range:=Selection.Range, Type:=wdFieldPage
Selection.TypeText Text:=" of "
objWord.Sections(1).Footers
(wdHeaderFooterPrimary).Range.Fields.Add
Range:=Selection.Range, Type:=wdFieldNumPages
Selection.ParagraphFormat.Alignment =
wdAlignParagraphCenter
After I format the document footer, I have the follwoing
line of code:
objWord.Content.Select
With Selection
Insert file here
end with
It looks like the selection is still in the footer area.
Is it anyway I can detect where the selection is and how
to redefine the selection?
Thanks for any help!
Mei Tag: "Compile error in hidden module: AutoExec" Tag: 58225
Updating autotext
I have a variety of autotext entries. Unfortunately, we have to constantly
revise and update these autotext entries back to the template (or even add
new entries). It's hard to explain to others how to do this.
So... here's my problem. I'd like to use VBA to create a menu that would
walk people through the process (highlighting the correct text,
automatically selecting the correct template, etc...).
Has someone already done this? Right now, I was pondering having a button on
the main menu (it's this whole big menu we have for inserting spec entries,
not to worry about that part) that says "update entry", then when you click
that button, the main menu is hidden while a msgbox pop up that says
"highlight text".You would press okay to get rid of the message box,
highlight the text, then... then... then I get a bit lost.
I want it to then pull up the resident wdDialogEditAutoText dialog box, but
and have it set automatically to the correct template (I think that will get
rid of a lot of confusion) but don't know how to force the dialog box to set
to a specific template in the "Look in" area.
I also don't know how you would go from highlighting text to bringing up
this dialog box.
If you need clarification on what I'm trying to do, feel free to ask.
Thanks in advance!
--
-Kirsten Tag: "Compile error in hidden module: AutoExec" Tag: 58224
Pass document reference into another doc?
I want the Document_Open macro in one doc to open another doc. The second
doc also has a Document_Open macro, and the first doc stays open until the
second doc is finished. Can I pass the object reference from the first doc
to the second so the second can completely close that instance of Word? Or
set a reference while the doc is open with a macro running and cause it to
close?
Ed Tag: "Compile error in hidden module: AutoExec" Tag: 58216
Error 462 problem.
I've written an Access 2000 app which creates some Word documents. There
is one place that it errors randomly on error 462 - The remote server
machine does not exist or is unavailable. To give an idea as to the
randomness, I ran it over 100 times yesterday on one PC (Win 2000 + Office
2000) and it never failed. On another machine running Win XP + Office XP
Standard + Access 2000, it fails about 80% of the time. On a 3rd PC,
identical to the 2nd, it fails less than 10% of the time.
And on any PC, if you step through the code, it never fails.
The pertinent parts of the code follows, with the point where it fails
indicated thus: ----->
Note that some code has been omitted for clarity/brevity.
----------------------------------------------------------------------
Dim objWord As Word.Application
Set objWord = GetObject(, "Word.Application")
objWord.Documents.Add Application.CurrentProject.Path & _
cStrWordTemplate
'----------------------------------------------------------------------
' Put in the header
'----------------------------------------------------------------------
With objWord
' .ScreenUpdating = False
' .Visible = False
.Selection.Goto What:=wdGoToBookmark, Name:="bkShopType"
.Selection.TypeText Text:=strShopType
.Selection.MoveRight unit:=wdCell, Count:=2
.Selection.TypeText Text:="Dealer " & _
rst.Fields("DealerID") & _
" - " & rst.Fields("Dealer Name")
.Selection.MoveRight unit:=wdCell
.Selection.TypeText Text:=strWave
.Selection.EndKey unit:=wdStory
.Selection.TypeParagraph
'----------------------------------------------------------------------
' Loop through the recordset and find all the questions where
' points were lost
'----------------------------------------------------------------------
Do While Not rst.EOF
If rst.Fields("PointsScored") < _
rst.Fields("PointsAvailable") Then
'----------------------------------------------------------------------
' Create the table to hold the data
'----------------------------------------------------------------------
.Selection.EndKey unit:=wdStory
.Selection.TypeParagraph
.ActiveDocument.Tables.Add Range:=.Selection.Range, _
NumRows:=1, NumColumns:=1, _
DefaultTableBehavior:=wdWord9TableBehavior, _
AutoFitBehavior:=wdAutoFitFixed
-----> Fails between here and the next 3 lines
.Selection.Tables(1).PreferredWidthType = _
wdPreferredWidthPoints
.Selection.Tables(1).PreferredWidth = _
CentimetersToPoints(19.5)
.Selection.Rows.HeightRule = wdRowHeightAtLeast
.Selection.Rows.Height = CentimetersToPoints(1)
----------------------------------------------------------------------
Anybody see the problem?
--
Roger Tag: "Compile error in hidden module: AutoExec" Tag: 58210
ActiveDocument object doesn't work
Hello all,
I have a problem with VB.Net.
I want to get the readabilityStatistics from word documents. herefore I have
to activate a doc as an ActiveDocument in the Word.Application. And here is
exactly the problem. I cannot use the ActiveDocument as it is written
everywhere in the MSDN!
Here is what I did:
...
Private Sub TestMSWordFunc(ByVal file As String)
'MS Word declarations
Dim wordApp_Server As Word.Application
Dim wordDoc As Word.Document
Dim wordRange As Word.Range
Dim wordStatistic As Word.ReadabilityStatistic
'Other
Dim fileMod As Boolean
Dim resComputeStatistics As Integer
Dim wordEnum As IEnumerator
Dim wordVal As ValueType
'Open an application server first
wordApp_Server = New Word.Application
wordDoc = wordApp_Server.Documents.Open( _
FileName:=file, _
ConfirmConversions:=False, _
ReadOnly:=False, _
AddToRecentFiles:=False, _
PasswordDocument:="", _
PasswordTemplate:="", _
Revert:=False, _
WritePasswordDocument:="", _
WritePasswordTemplate:="", _
Format:=Word.WdOpenFormat.wdOpenFormatAuto, _
Visible:=False)
'Document must be set active in order to retrieve further information
wordApp_Server.Documents.Add(file)
wordDoc = wordApp_Server.ActiveDocument
Label_ResultFile.Text = file
Label_ResultWords.Text =
wordDoc.ComputeStatistics(Word.WdStatistic.wdStatisticWords)
Label_ResultParagraphs.Text =
wordDoc.ComputeStatistics(Word.WdStatistic.wdStatisticParagraphs)
Label_ResultFK.Text =
wordApp_Server.ActiveDocument.Content.ReadabilityStatistics.Item(6).Value
...
I cannot get to tell the application the open word document!! The last line
always returns zero, as the ActiveDocument is empty,i.e. a different document
than the one I opened!
Can anybody help me?
I am getting crazy. It is probably very easy, but I cannot see the mistake.
Kisses
Mel Tag: "Compile error in hidden module: AutoExec" Tag: 58208
This message box comes up upon entering and existing MS Word