Form template macro VB security
How do I make sure that my VB macro is stored in my
template(dot, not Normal one) so when I share with other
users they can accept the self-certificate I've created
and the macro will run?
When I send my form/template to another user, they get
Macro Disabled error. Any suggestions would be great!
Pat Tag: How do I run a Word macro from a web page Tag: 58369
Mouse Move Causes Automation Error
I want to use mouse move to close a second form (hide or unload)
It works fine until I make it a .dot in the startup folder, then I get an
Automation error.
I've tried several things, includine using 'on error resume', but can not get
it to work as a .dot in Start Up.
Any suggestions would be appreciated.
TIA Tag: How do I run a Word macro from a web page Tag: 58367
How can I get contents of word doc without using the clipboard?
I have a C# application that has need to open a word document by automating
word, using COM, and extract the contents of the word document and insert it
into a rich text box in a form. I can easily do this by having Word copy
the contents of the doc to the clipboard, and then pasting the contents into
the rich text box. The problem is that this trashes the previous contents
of the clipboard in the process. I went down the road of trying to save and
restore the clipboard, but had problems with the interaction with the
"Office Clipboard". There may be a way to get that to work (saving and
restoring the clipboard), but it seems like there must be an easier way -
just extracting the contents of the word doc directly. How do you do that?
I see the "Text" property can be used to extract the contents as plain ASCII
text, but what if I want to extract the rich text formatted text?
- Dave Tag: How do I run a Word macro from a web page Tag: 58365
Setting properties for multiple table cells, vba
Word 2003, WinXP, SP2
The following code works just fine to set properties in a single cell,
setting only the first cell if multiple cells have been selected.
With Selection.Cells(1) ' Processes single cell.
.TopPadding = InchesToPoints(0.02)
.BottomPadding = InchesToPoints(0#)
.LeftPadding = InchesToPoints(0.05)
.RightPadding = InchesToPoints(0.05)
.WordWrap = True
.FitText = False
End With
I'm trying to get the code to run on all selected cells. The
following code and other, simliar tries bombs.
Dim c As Cell
For Each c In Selection.Cells
.TopPadding = InchesToPoints(0.02)
.BottomPadding = InchesToPoints(0#)
.LeftPadding = InchesToPoints(0.05)
.RightPadding = InchesToPoints(0.05)
.WordWrap = True
.FitText = False
Next c
"Compile error:
Invalid or unqualified reference"
Thanks for your help,
Fred Holmes Tag: How do I run a Word macro from a web page Tag: 58361
"Control could not be created"??
I created a doc in Word 2000/Windows 2000 with a CommandButton in the
document. There is a "enable macros" warning that a Document_Open macro
deletes, if macros are enabled. I gave it to another user with Word/Win XP
to try out. He got a message "Could not exit design mode because the
control could not be created". The "macros" warning was not deleted. His
macro security is set to medium, and he clicked "Enable Macros".
Any tips on clearing this up? Any alternatives to a button - like maybe a
"click here" link in the text that will fire the macro?
Ed Tag: How do I run a Word macro from a web page Tag: 58359
Footnote options problem
Hi All
I've got a problem using Dialogs(wdNoteOptions) to change footnote options.
We're using code to intercept the insert footnote command to make sure that
footnote references at the bottom of the page are not superscripted. The
code is slightly modified code copied from the MVP site (see end of this
post).
Using an InsertFootnote macro seems to disable the footnote/endnote options
dialog (can't get it to display from the standard menu or by right clicking
etc). However we can get it to display by highlighting the note reference in
the text and typing one character -- a Word dialog appears asking if the user
wants to delete (overwrite) the footnote or change the options.
We'd like to be able to call the NoteOptions dialog from a toolbar macro.
However, when I use Dialogs(wdDialogNoteOptions).Show to display the note
options dialog I get unwanted behavior after choosing options and clicking OK.
For instance, if I use Dialogs(wdDialogNoteOptions).Show and choose
"A,B,C..." in the "Number format" field, and click OK, the footnote numbers
change to "i, ii, iii", not "A,B,C". Or if I choose "*, +" etc from the
"Number format" field, the references change to "1st, 2nd" etc, not "*, +"
etc (this latter behaviour is puzzling because "1st, 2nd, 3rd" etc isn't an
option available in the Note Options dialog).
Note that this unwanted behaviour doesn't happen if I highlight the
reference in the text, type a character and bring up the Note Options dialog
that way. So the erratic behaviour appears to be related to be *using code*
to display the Note Options dialog, not the Note Options dialog itself.
Does anyone have any ideas as to why this is happening and more importantly,
how can I get Dialogs(wdDialogNoteOptions).Show to work properly while still
intercepting InsertFootnote to make sure footnote references at the bottom of
the page are not superscripted?
Many thanks for any help -- InsertFootnote code below for reference...
Sub InsertFootnote()
'
'This macro intercepts Insert > Footnote and automatically
'changes footnote numbers from superscript to normal
ActiveDocument.Footnotes.Add Range:=Selection.Range
With Selection
.Paragraphs(1).Range.Font.Reset
.Paragraphs(1).Range.Characters(2) = ""
.InsertAfter "." & vbTab
.Collapse wdCollapseEnd
.Paragraphs(1).Style = "Footnote Text"
End With
End Sub Tag: How do I run a Word macro from a web page Tag: 58358
Help from Wildcard search gurus.
Okay, I've programmed a wildcard macro that searches for text that ostensibly
appears in a list format, but it's not formatted according to Word's bullets
and numberings lists. It searches out text that looks like this:
1. text here
2. text here
and replaces it with text formatted in a numbered list. The macro searches
for any number followed by a period, space and then text. It replaces the
number and period with an em dash then reformats the entire text in a
numbered list. This was working fine until the user discovered it was taking
years at the ends of sentences followed by one or two spaces and deleting
some of the numbers. For example, 1957. ends up being 19 or 195 <and the new
sentence begins here>. There is also a macro that searches for unformatted
text that begins with a., b., c. and follows that list structure. This was
working fine until acronyms like s.q. (for square feet) were used.
Here are some samples of my code. I apologize for the length. I realize
there are some redundancies in the code - I am still a newbie at using
wildcard searches in code. Any help would be greatly appreciated:
Replacing unformatted numbered lists:
With Selection.Find
.Text = "[0-9].[!0-9*^13]"
.Replacement.Text = "^+"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Style = ActiveDocument.Styles("List Number")
With Selection.Find
.Text = "^+*^13"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Style = ActiveDocument.Styles("List Number")
With Selection.Find
.Text = "^+*^13"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^+"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Replaces unformatted alpha lists with a style called List Alpha:
With Selection.Find
.Text = " [ A-z].[!0-9*^13]"
.Replacement.Text = "^+"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "[ A-z].[!A-z*^13]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Style = ActiveDocument.Styles("ListAlpha")
With Selection.Find
.Text = "^+*^13"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^+"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
TIA,
Jason Tag: How do I run a Word macro from a web page Tag: 58352
Word Documents in my application taskbar
Hi,
I'm writing a VB application that makes use of a Word Document, just as
Outlook uses Word to edit emails.
I've noticed that Word Documents produced by Outlook appear in the Outlook
taskbar group, though they are Word documents all right. From there you can
open new documents, that appear in the Word taskbar group. Moreover if you
use click "File->Exit" from this new document the Outlook message is not
closed.
In my application I use COM to create a new document:
set myDoc = new Word.Document
myDoc.ActiveWindow.Visible = True
but in this way my document goes in the Word taskbar group, and when I click
on menu "File->Exit" my document is closed as well.
Finally when using Word from Outlook the "File->Exit" menu does not seems to
close the application, and the document has a different Icon.
Does anybody knows how to reproduce the Outllok behaviour? It it possible
through the COM interface? Do I have to use a different integration method?
Thanks
Sergio Cortese Tag: How do I run a Word macro from a web page Tag: 58348
BookMark in Header
Is it possible to reference a Bookmark in a header?
I am creating a contract with a Fill In Form that will open automatically
via AutoNew, the user will fill in the blanks and click OK. Word will
populate the information throughout the document for the user. We need a
contract number to be placed in the header bc it needs to be on every page.
Any ideas? Tag: How do I run a Word macro from a web page Tag: 58341
Macro to center tables?
I am working on a 275 page document that has 1 table per page. I want to
make a macro that finds every table in the document and centers it on it's
page. Is this possible? Tag: How do I run a Word macro from a web page Tag: 58340
Prevent Logo Resizing?
Word 2000.
I am trying to save a small header logo as a jpg and use VBA to insert
it into the header of a 2d document. The logo keeps getting larger or
smaller.
Then I tried doing it by hand.
Same thing!
Here are details.
I copy a small logo from the heading of one document
into the heading of another document and the size of the
logo changes!!(?)
The bitmap dimensions are as follows (from format picture selection):
Height .72" Width 3.75"
Scale Height 112% Width 111%
Both boxes "Lock aspect ratio" and "Relative to original picture size" are
checked.
Original size
Height .64"
Width: 3.38"
When I paste into the header of a 2d document, the logo enlarges itself.
The header of the 2d document has some text in the header and that is all.
How do I prevent this from happening.
(Note: if I paste the logo into a new blank document, no size change, it
pastes perfectly).
Thanks
Jim Tag: How do I run a Word macro from a web page Tag: 58339
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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page 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: How do I run a Word macro from a web page Tag: 58242
I would like to create a script for a form online that would run a macro
depending on what the user inputs. What would be the best language to write
this script?