Hide and show components
Hi : )
I am build some kinda of reports and I have some information I would like to
let the user show if he/she want to see or not. If he/she want to see, he/she
will click in image component. But I would like to use the 'same' (visually
talkin) component to hide the data. This is a sample:
Private Sub Image1_Click()
Selection.GoTo What:=wdGoToBookmark, Name:="interfaces_lista"
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Tables(1).Select
With Selection.Tables(1)
With .Borders(wdBorderLeft)
.LineStyle = wdLineStyleDashSmallGap
.LineWidth = wdLineWidth050pt
.Color = 14540253
End With
With .Borders(wdBorderRight)
.LineStyle = wdLineStyleDashSmallGap
.LineWidth = wdLineWidth050pt
.Color = 14540253
End With
With .Borders(wdBorderTop)
.LineStyle = wdLineStyleDashSmallGap
.LineWidth = wdLineWidth050pt
.Color = 14540253
End With
With .Borders(wdBorderBottom)
.LineStyle = wdLineStyleDashSmallGap
.LineWidth = wdLineWidth050pt
.Color = 14540253
End With
With .Borders(wdBorderHorizontal)
.LineStyle = wdLineStyleDashSmallGap
.LineWidth = wdLineWidth050pt
.Color = 14540253
End With
With .Borders(wdBorderVertical)
.LineStyle = wdLineStyleDashSmallGap
.LineWidth = wdLineWidth050pt
.Color = 14540253
End With
.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
.Borders.Shadow = False
End With
With Options
.DefaultBorderLineStyle = wdLineStyleDashSmallGap
.DefaultBorderLineWidth = wdLineWidth050pt
.DefaultBorderColor = 14540253
End With
Selection.Tables(1).Rows.Height = CentimetersToPoints(0.6)
Selection.Font.Color = wdColorGray80
Selection.Font.Size = 8
Selection.GoTo What:=wdGoToBookmark, Name:="interfaces"
End Sub
So, when I click in the icon, a table shows up with some data, and to 'hide'
it, I use:
Sub interfaces_compact()
Selection.GoTo What:=wdGoToBookmark, Name:="interfaces_lista"
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Tables(1).Select
With Selection.Tables(1)
With .Borders(wdBorderLeft)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorWhite
End With
With .Borders(wdBorderRight)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorWhite
End With
With .Borders(wdBorderTop)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorWhite
End With
With .Borders(wdBorderBottom)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorWhite
End With
With .Borders(wdBorderHorizontal)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorWhite
End With
With .Borders(wdBorderVertical)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorWhite
End With
.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
.Borders.Shadow = False
End With
With Options
.DefaultBorderLineStyle = wdLineStyleSingle
.DefaultBorderLineWidth = wdLineWidth050pt
.DefaultBorderColor = wdColorWhite
End With
Selection.Tables(1).Rows.Height = CentimetersToPoints(0#)
Selection.Font.Color = wdColorWhite
Selection.Font.Size = 1
Selection.GoTo What:=wdGoToBookmark, Name:="interfaces"
End Sub
So, there is some way to use the control to show up the table (code 1), and
if the table is show and I click in the control again it hides (code 2)?
I tried to hide the component... but I didn´t get sucess.
Thanks for any info. Tag: how do I add scripts to my word doc? Tag: 109162
Word 2007 Dotm vs. Dot, slow loading of Word
Hi,
I have a DOT file, it's rather large (3,5MB) but works fine in Word 2003 and
Word 2007. The file has lots of functionality, userforms, modules and a
custom commandbar and i've already converted it to DOTM (1,5MB) with Custom
Ribbon UI instead of the commandbar. The problem is, that the DOTM file
ENORMOUSLY slows down Word 2007 startup (the dot-file needs to be in the
startup folder).
When I just load the old DOT file (exactly the same functionality, but not
in the new format) Word 2007 startup speed is fine. But then I cannot have
Custom Ribbon UI.
Is this a known issue or is there a way to speed up the loading of my DOTM
file? I really want to be able to use the Custom Ribbon UI XML.
P.S. I know my DOT file maybe should be a real Add-In (VSTO DLL or whatever)
but that will not happen soon for many reasons. Tag: how do I add scripts to my word doc? Tag: 109161
FormField
I have linked text to a FormField on my document and it changes when I
manually change the selected item of the FormField. However, when I change
the item in a Macro like so it doesn't change the linked text to match:
ActiveDocument.FormFields("PortfolioAnalyst").Result = PersonSelected
Has anybody ever dealt with this before? Thanks! Tag: how do I add scripts to my word doc? Tag: 109158
Help writing a picture formatting macro
Hello,
I was wondering if you guys could help me.
I am trying to write a macro to format a picture I have pasted into a
word document.
Unfortunately the wrap to text and advanced functions of the format
picture tab are not available when writing a macro.
I have seen someone here had the same problem and the following code
was posted:
With myShape
.WrapFormat.Type = wdWrapTopBottom
.WrapFormat.DistanceTop = InchesToPoints(0.2)
.WrapFormat.DistanceBottom = InchesToPoints(0.2)
.RelativeHorizontalPosition =
wdRelativeHorizontalPositionPage
.Left = wdShapeCenter
The thing is my requirements are different to this and now matter how
I change the code above I can't get it to work.
Can anyone help please?
I need the options
Wrap type = Square
Horizontal Alignment = Other
and in the advanced options
Absolute position 4.23 from the right of the page
Absolute position 0.00 below paragraph.
I know this is quite complicated and a big ask - but if anyone can
help it would be amazing as i have to format pictures according to
this layout about 20 times a day as part of my job and a macro would
totally help me out.
Thanks,
Sotiris Tag: how do I add scripts to my word doc? Tag: 109150
Protect Form macro errors
When I activate the Protect Form function on my templates and then
open them via a 3rd party preview screen I get a series of error
messages before the macro works. I need to protect the form for the
form fields to work and the templates are for a 3rd party system so I
cant have these errors appearing. The errors persist with the AutoOpen
macro and I cant set up an entry macro as the form needs to be
protected for that to happen - a bit of a catch 22!! Any ideas would
be appreciated. Tag: how do I add scripts to my word doc? Tag: 109143
unlink Footer/Header in VBA
Hi,
I need your help desperately. I've been trying to get this to work since
yesterday but to no avail. I was trying to insert Header/Footer using VBA in
word 03. This will involve section breaks insertion into the document.
My problem is i think i haven't really put the following code in the right
place.
Selection.HeaderFooter.LinkToPrevious = Not Selection.HeaderFooter. _
LinkToPrevious
Different Sections will have different Header and Footer in the document.
Here is my code of inserting a section of "Bibliography" into the document.
This might be placed in the middle of the document.
Sub InsertBibliography()
'Apply Header for previous section
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.LinkToPrevious = Not Selection.HeaderFooter. _
LinkToPrevious
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.TypeText Text:="Header 1"
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=vbTab & vbTab & "Date Issue"
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.MoveLeft Unit:=wdCharacter, Count:=16
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Selection.InsertBreak Type:=wdSectionBreakNextPage
'Selection.InsertBreak Type:=wdPageBreak
Selection.TypeText Text:="Bibliography"
Selection.MoveLeft Unit:=wdCharacter, Count:=12, Extend:=wdExtend
Selection.Font.Color = wdColorGreen
Selection.Font.Bold = wdToggle
Selection.Font.Size = 16
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeParagraph
Selection.Font.Size = 12
Selection.Font.Color = wdColorAutomatic
'Apply Header for Bibliography
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
'Selection.HeaderFooter.LinkToPrevious = Not Selection.HeaderFooter. _
LinkToPrevious
Selection.TypeText Text:="Company Name"
Selection.MoveLeft Unit:=wdCharacter, Count:=11, Extend:=wdExtend
With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, Name:="clientname"
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=vbTab & vbTab & "Report Line1"
Selection.MoveLeft Unit:=wdCharacter, Count:=12, Extend:=wdExtend
With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, Name:="reportline1"
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeParagraph
Selection.TypeText Text:=vbTab & vbTab & "Report Line2"
Selection.MoveLeft Unit:=wdCharacter, Count:=12, Extend:=wdExtend
With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, Name:="reportline2"
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
'Apply Footer
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
If Selection.HeaderFooter.IsHeader = True Then
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Else
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
End If
Selection.TypeText Text:=vbTab & "Page S"
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldPage
Selection.HeaderFooter.LinkToPrevious = Not Selection.HeaderFooter. _
LinkToPrevious
With Selection.HeaderFooter.PageNumbers
.NumberStyle = wdPageNumberStyleArabic
.HeadingLevelForChapter = 0
.IncludeChapterNumber = False
.ChapterPageSeparator = wdSeparatorHyphen
.RestartNumberingAtSection = True
.StartingNumber = 1
End With
Selection.MoveUp Unit:=wdLine, Count:=3
Selection.MoveRight Unit:=wdCharacter, Count:=7
Selection.TypeBackspace
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub
Bibliography Section will have its own Page format in the Footer namely Page
S1, Page S2, and so on. Whereas for the content of the doc, Page 1, 2, etc.
is used.
Greatly appreciate if anyone might be able to give me your advise here.
Thank you in advance Tag: how do I add scripts to my word doc? Tag: 109142
How to convert word to html with .net
I store word docs in a sql2005 database as images. I can retrieve the docs
from the database as byte arrays. I need to be able to then save the docs as
temporary files on the server in html format. I think I sould be able to use
microsoft.office.interop.word to accomplish this but I have no idea how to
start. I am using asp.net 2.0 and vb.net. If anyone has any vb ( or c# code
that I could use, I would really appreciate it) Tag: how do I add scripts to my word doc? Tag: 109140
Saving
When I save my 100 page document at say page 50 and then close it and
re-open it, it always goes back to the beginning. Is there any way to have
it open where you saved it last? Tag: how do I add scripts to my word doc? Tag: 109139
Show today's date
Hi! Every day I write a report. In the heder of that report is todya's date.
Is there any way that I can write code (or some other way) so that the date
in the header is always todays date? Thanks! Tag: how do I add scripts to my word doc? Tag: 109129
Get a list of a word document reviewers
I would like to write a macro that will display a list of the document
reviewers to the macro user for selection. The macro will then be able
to jump to the next revision made by the selected reviewer.
However, i could not find a simple way of getting the list of
reviewers (as appears in the Reviewing tool bar). The only way i could
think of, is walking through all revisions and look for the author of
each one, but this may take tool long.
Any idea? Tag: how do I add scripts to my word doc? Tag: 109127
Dynamic userforms
Hello,
I have created a Word template with a userform attached which appears
on-screen for the user to fill-in and subsequently insert information into a
letter. The macro which initiates this pop-up userform works great. However,
it would be nice to place a date field into the userform that displays the
date a developer last made a change to either the macro or userform
associated with my template. Essentially, I would like to have a dynamic
form in the sense that it displays the date when the template is saved. As
you know, changes to macros and forms only take effect when the associated
template is saved. I know this feature can be done with Javascript for
webpages. Is there something similar under the hood of VBA for Word?
Iâ??m trying to take the headache away from the developers so they will not
have to manually insert a date each time they save changes to the macro
and/or form. Not only would this be invaluable to developers for quality
assurance but it would keep the end user informed to updates.
Thanks!
Ellen Tag: how do I add scripts to my word doc? Tag: 109126
Code to remove 'Enter' Symbols
I recieve Text files that come from a HTML form and they are delimited by
comma. One of the fields allows people to paste in account information that
has a set format and adds in TABs and Line breaks or the symbols you get get
when you hit enter.
I need to scrub this out of file. Is there any little script that I can run
in Word that would remove these?
THanks!
Mark Tag: how do I add scripts to my word doc? Tag: 109125
Function shortcut help
Hi,
I recently saw some VB code and there was a shortcut and I was hoping
someone knew what is its correct term.
When creating an object that required parameters (or a function), rather
than putting blanks or nulls in optional parameters, the code named the
param and gave it a value.
In other words, if the function was defined as
functionName(optionalParam1, optionalParam2, optionalParam3, optionalParam4)
it could be called as
functionName(optionalParamName3=paramValue3, optionalParamName4=paramValue4)
or something like that. I would like to read more about this, but what is
it called? Tag: how do I add scripts to my word doc? Tag: 109117
Macro to Search for Keyword in Files
I'm trying to set up a search for keywords in a specific set of files. I
don't want to have to go through and check the multitude of boxes over and
over again.
Ideally a macro button to execute such a search would be a Godsend.
Anybody have any ideas?
Thanx. Tag: how do I add scripts to my word doc? Tag: 109114
Serial Number Macro Problem with zeroes
I use the following macro in Word 2003 to produce sequentially numbered
certificates & have 2 problems with it.
Sub SEQserialnumber()
'
' SEQserialnumber Macro
' Macro created 11/09/2007 by Sharon
'
Dim Counter As Long
Dim Message As String, Title As String, Default As String, NumCopies As
Long
Dim Rng1 As Range
' Set prompt.
Message = "Enter the number of copies that you want to print. Get
it right you can't stop it!"
' Set title.
Title = "Print"
' Set default.
Default = "1"
' Display message, title, and default value.
NumCopies = Val(InputBox(Message, Title, Default))
' Edit from Jay Freedman to enable user to specify serial number
Message = "Enter the starting serial number"
Title = "Serial Number"
SerialNumber = Val(InputBox(Message, Title, Default))
'Next line added to cause Ask field to fire pop-ups
ActiveDocument.Fields.Update
Set Rng1 = ActiveDocument.Bookmarks("SerialNumber").Range
Counter = 0
While Counter < NumCopies
Rng1.Delete
Rng1.Text = SerialNumber
ActiveDocument.PrintOut
SerialNumber = SerialNumber + 1
Counter = Counter + 1
Wend
'Recreate the bookmark ready for the next use.
With ActiveDocument.Bookmarks
.Add Name:="SerialNumber", Range:=Rng1
End With
'Next line added to update { REF SerialNumber }
'This is more selective than just updating all the fields; in
'particular, the Ask fields (which have .Type = wdFieldAsk) won't be
'updated the second time.
Dim Fld As Field
For Each Fld In ActiveDocument.Fields
If Fld.Type = wdFieldRef Then Fld.Update
Next
ActiveDocument.Close SaveChanges:=False
End Sub
Problem 1: I know find out that serial numbers begin with zeroes e.g.
0000001 to 0000005. If zeroes are entered they do not print and they must do
so to much pre-printed labels.
Problem 2: The 2nd serial number instance is not printing. This is a
mergefield in the document as below.
{ REF SerialNumber \*MERGEFORMAT }
I would be truly grateful for some help with both of these, thanks. Tag: how do I add scripts to my word doc? Tag: 109107
Word Macro opening Mail Merge Template
I am attempting to upgrade a Word Macro from Word 2000 that runs as a
forground task scheduled via windows scheduler on a unattended server.
During the running of the macro it opens a template built for mail merge that
latter dynamically attaches to a CSV data source.
The issue I am having is that under 2003 opening the templete stops with
"Opening this document will run the following SQL command:" goes on to list
the CSV data source file path which I believe is a request to attach the data
source.
I need to suppress this request message. Currently the template is being
opened with "Documents.Add Template:=Tmplt, newtemplate:=True,
documenttype:=0"
The current folder contains the template named in the variable "Tmplt".
Suggestions?
--
Ron H Tag: how do I add scripts to my word doc? Tag: 109099
Convert Microsoft Word document to jpeg, multi-page TIFF image
Website: http://www.joyprinter.com
Joy Image Printer is a high-performance virtual printer which enables
you to convert any printable document into standard BMP, GIF, JPEG,
PNG and TIFF image, and keep the exact look and feel of the original
document. Since the converted image has the complete information from
the original file without altering characters or fonts, you don't
need
to install the original software to view the document.
Key Features:
(1) Installs as a standard Windows printer, works for all Windows
applications directly
(2) Converts any printable documents like doc, xls, ppt, rtf, html and
CAD into images
(3) Supports BMP, GIF, PNG, JPEG and TIFF formats
(4)Creates Thumbnails for Printing document
(5)Dynamic file and folder generation based on macros
(6)Supports both single and multi-page TIFF file formats Tag: how do I add scripts to my word doc? Tag: 109098
Subroutine Library
I am looking foran efficient way to build a subroutine library. I have
thought of just using an excel file with a lot of mofules or using access.
They each have drawbacks. How are you managing your subroutines? Tag: how do I add scripts to my word doc? Tag: 109095
Remove "TEXT" from CommandBar
This is what I am using to remove but in this instance it is not suitable -
it does not remove it? I use this in 2003/2007 - any help would be
appreciated to get "Style" TEXT removed from CommandBar would be
appreciated!
'If you want to remove the item from the menu, you can do it like this:
Sub RemoveDoStyles()
Dim cb As CommandBar
Dim ctl As CommandBarControl
CustomizationContext = NormalTemplate
Set cb = CommandBars("Text")
For Each ctl In cb.Controls
If ctl.Tag = "Style" Then
ctl.Delete
End If
Next
End Sub
This is the macro that puts the "Style" TEXT on the CommandBar?
Sub DoStyles()
Dim StyleCount As Integer
Dim J As Integer
Dim x As CommandBar, z As CommandBarComboBox
On Error Resume Next
StyleCount = ActiveDocument.Styles.count
Set x = CommandBars.Add("AllMyStyles", msoBarPopup)
Set z = x.Controls.Add(msoControlComboBox)
z.Caption = "Active Styles:"
For J = 1 To StyleCount
If ActiveDocument.Styles(J).InUse Then
z.AddItem ActiveDocument.Styles(J)
End If
Next J
z.Text = Selection.Style
x.ShowPopup
Selection.Style = z.List(z.ListIndex)
CommandBars("AllMyStyles").Delete
End Sub Tag: how do I add scripts to my word doc? Tag: 109091
Is word at end of the line
When I seach for a word with the code:
Selection.Find.ClearFormatting
With Selection.Find
.Text = " on"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Is there a way to determinine is the word is the last word on that line? I
want to certain words to be moved to the next line if they are at the end of
a line. Tag: how do I add scripts to my word doc? Tag: 109087
assistant goodbye
At the beginning of your code, you set isVisible = Assistant.Visible
If the end of your code has
.Animation = msoAnimationGoodbye
...and then you finish up with
Assistant.Visible = isVisible
But if the assistant wasn't visible when the user start the code, then this
last line does away with the previous line of animation, so that the
assistant just disappears. ...is there a way to fix this? Tag: how do I add scripts to my word doc? Tag: 109085
Am I at the end of the document
In my code I have:
Selection.EndKey unit:=wdLine
...this puts me at the end of that line. It's there a way to tell if that
is the last line in the document?
thanks. Tag: how do I add scripts to my word doc? Tag: 109082
Unicode Find Question
Can Unicode be used in the range.Find function?
In this case, the Cyrillic font word is pasted in a textbox (MS Forms 2.0
library) that a range.Find.execute() routine uses as its Find.Text. How do
you assign an entire Unicode word to Find.Text? Word 2003, Windows XP. Tag: how do I add scripts to my word doc? Tag: 109078
Formfield Question
I have a document and in it there are 35 checkboxes (Formfields). I have a
form to edit the document but I canâ??t set the checkboxes in the document as
checked/unchecked base on how the form is filled out. How do you write a
macro so that if the checkbox in the form is checked/unchecked it will
check/uncheck the checkboxes in the document? Tag: how do I add scripts to my word doc? Tag: 109076
Supress blank text
Using Word 2003 with Windows XP
My VBA skills - Fair
I have a template which I inherited. It is a monthly activity report for
off site workers. The template contains 6 areas for acitivity reporting.
Each area has 25 entry possiblities.
In the first area - Meeetings - off site employees are required to report
the meetings they attended. There is MeetingDate1, followed by
MeetingReport1 all the way down to MeetingDate25 and MeetingReport25.
What I would like to do is find some way of supressing any of the Meeting
fields that are blank when the report prints. Right now, the report prints
over 5 pages but most of the time there may be only 10-15 lines of actual
text. Tag: how do I add scripts to my word doc? Tag: 109075
Copy borders
I want to copy all borders of an HTMLDivision object to a selection.
The HTMLDivision will be deleted before the copy. What is the best way to do
this without doing so for each individual border? Tag: how do I add scripts to my word doc? Tag: 109074
Help with Clipboard / moving data
Hello,
I have a word vba app (word 2003) that has to get a lot of data from the
clipboard, then parse it / display some of it.
The clipboard data is in a table format, copied from another application
that I can not access programmatically and get zero help from the IT dept
here. When I copy it onto the clipboard, all of the stuff that I want is
in the first table, but it also copies some text and possible a picture
file after the table (which I subsequently ignore when parsing the data)
Currently, I copy the data onto the clipboard from the other application,
then paste it into a new document, then the table/data is read into an
array and the sorting etc takes over and every thing is good. The orginal
paste is deleted
Is there a way to get the table data directly from the clipboard into a
multicolumn array? I have only the vaguest idea what a dataobject is in
connection to this and how this could be used with the clipboard object,
the word help file is pretty slim.
Thanks,
Jim
jimoc@comcast.net Tag: how do I add scripts to my word doc? Tag: 109067
Checkboxes
I have a template and in it there are 20 checkboxes. I have created a user
form to edit the template. How do I save the checkbox info in the form back
to the checkboxes in the template? Tag: how do I add scripts to my word doc? Tag: 109047
Merging Bookmarks
I have a Word 97 form with bookmarks. I have a command button with
code that sends the bookmarked data to an Access database. I want to
include in the code a way to check Bookmark A. If Bookmark A contains
no data, insert the data from Bookmarks B and C into Bookmark A.
Thanks for any help you can give me
Ron Tag: how do I add scripts to my word doc? Tag: 109046
Problem in macro referencing a Com Class built on Dotnet 2.0
Hi Everyone,
I am having a hard time working with Com dll with Word 2003. This is my
first post in this forum and i desperately need help. I thank you in advance.
Scenerio:
I created a Com Class in VB.Net 2.0, which has some public properties,
functions. I use WebClient in the class to download data. I created the setup
using Deployment Wizard containing Test.dll and Test.tlb. I Install it in a
test system and reference the Test.tlb in a word Macro. i can create an
object of my com class. Set a property with text. Display the property in a
msgbox. The Code as follows:
Dim obj As New Testproject.TestClass
obj.MyStr= "The Macro works"
MsgBox (obj.MyStr)
Problems:
When i run the macro it gives me error as:
-2147024894
File or assembly name Testproject, or one of its dependencies, was not found.
Regards
Rohim Tag: how do I add scripts to my word doc? Tag: 109045
Help text not showing
Help text that I have added to a form field does not show on the status
bar.... so, I tried putting it into the Help key (F1) but the help text does
not appear.
Any suggestions? Tag: how do I add scripts to my word doc? Tag: 109042
Control Color for Multipage pages
I am able to set the backcolor for a Multipage, but the individual pages
(and their tabs) maintain the color (apparently) of System:ButtonFace. There
is no 'BackColor' in the Properties list at the left for the individual
pages. Is there a way to control the color of the individual pages, and
their tabs.
Ed (in Virginia) Tag: how do I add scripts to my word doc? Tag: 109032
Changing chemical notation
Hello, I have very large documents with chemical formulas and notation (ex.
CH4 or H2SO4 but never 3H2O (The three is at the biggining of the word))
I would like to:
For each word in the selection (after I selected something) chek if there is
a number sticked (and after) the first and or second and or third ......
letter; if so the to change all the numbers in that word to subscript numbers.
I dont have any experience working with word VBA (some with excell VBA)
thanks a lot Tag: how do I add scripts to my word doc? Tag: 109030
Can I Use VBA to register global templates?
Does anyone know how to use VBA to write a windows registry key that tells
Word where a global template is located?
My Problem:
I have several workgroup templates that contain references to one global
template which contains a ton of code I use again and again from my workgroup
templates.
As I create the templates, I use "Tools, References" to set the references.
At that point I am logged in as myself and my global template is in the
default word startup folder (in the user profile).
(I want to keep the folder in the default location so I am not affecting
other people who may also be programming for Word and expect to put their
templates there.)
WHAT IS HAPPENING: Several different people may log onto any given computer.
As they do, a login script copies their templates into place for them. WHEN
THIS HAPPENS, sometimes my reference gets broken. It seems it is not looking
to the current startup folder for the global template -- rather it looks to
the other person's location. Internet research tells me when Word looks for
referenced, it looks in a location listed in a registry key for that template
first.
I tried using vba to look for broken refs and fix them, but this isn't
working because my templates crash with a "can't find project or library"
compile error due to other code in them, before they can even run the "fix
references" code.
I BELIEVE the problem is that the windows registry key for the global
templates is still listing the template in the previous users profile and it
is either an old version of the template, or not in a "trusted" location and
won't load due to macro security.
If I could run a line of code in an autoopen macro in my global template
that sets that windows registry key to the current users Word startup
directory I THINK that would fix the problem. But I have no idea what they
key is or how to write to the registry.
Sorry so long! Please help...!!!! Tag: how do I add scripts to my word doc? Tag: 109021
clip and copy do not work on toolbar or keyboard
I am unable to activate clip and copy toolbar buttons on either my keyboard
or the toolbar. The Paste works okay. I have gone into the customize on the
Edit menu and tried to correct that way but the changes I make are not
retained after I close the customize window. Does anyone have any
suggestions. I have just had to install everything as my XP totally crashed
and installed XP Office Professional Suite which has Word 2003 etc included. Tag: how do I add scripts to my word doc? Tag: 109017
Appending REF Field data to a csv file
I'm trying to write a macro to take REF field data in MS Word and save/append
that data in a csv file.
So far, I've been able to pull the REF field data and put it in a variable
named sOutput.
(i.e. [sOutput = sInvno & ", " & sDate & ", " & sPartno & ", " & sSerno & ",
" & sDesc & ", " & sStatus & vbCr])
The output of this variable outputs each of the data points comma separated.
I want to take this data, append it to a csv file and automatically save it
without any user interaction. I haven't been able to find any code that can
help me.
Can somebody help me out?
Thanks, Davis Tag: how do I add scripts to my word doc? Tag: 109011
Printing contents of a section twice
First I am using Word 2003. My macro needs section 2 to be printed twice in
a certain order, for example, Client #1, two copies, Client #2, two copies,
Client#3, two copies, etc. The number of clients can vary, but the beginning
page number in the macro is always Page 2. Then I only need to print 1 copy
of Section 1 and one copy each of Sections 3-9. Tag: how do I add scripts to my word doc? Tag: 109010
How to "unset" table parameters
Hello,
I have written two macros for copying and pasting table formats.
If the first table does not have a preferred width set, the value is
9999999. The second table may have a preferred width but since I want to make
the same as the table copied, I cannot set the preferred width to 9999999
because I get an error. How then do I "unset" this parameter? Also, the
preferredwidthtype of the first table does not appear to be
wdPreferredWidthAuto.
I have a similar problem with cell widths but the width returned is
255919243. I get an error with this one as well.
Peter Tag: how do I add scripts to my word doc? Tag: 109009
Error closing files and quitting Word 2007 SP1
I'm using C# for Word interop and can't find another newsgroup so here goes.
I'm creating an instance of Word 2007 SP1 and successfully loading in a
file. However, when I ask it to close all documents, it fails with a COM
error of "Command Failed", HRESULT -2146824090.
The code I'm using is as follows:
// To open the document...
// Not included all variables, but should be obvious what they are...
object format = WdOpenFormat.wdOpenFormatAuto;
this.wordApplication.Documents.Open(
ref theFilename,
ref missing,
ref isReadOnly,
ref oFalse,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing,
ref format,
ref missing,
ref isVisible,
ref missing,
ref missing,
ref missing,
ref missing);
And to close all documents...
object saveChanges = WdSaveOptions.wdDoNotSaveChanges;
object missing = System.Type.Missing;
this.wordApplication.Documents.Close(ref saveChanges, ref missing, ref
missing);
When I open another document I get another window for Word which I don't
want (all documents must open in the same window).
Any suggestions welcome.
Thanks.
Haydn Tag: how do I add scripts to my word doc? Tag: 109002
triggering formfield formatting
I have a legal document set up as protected for filling out forms, and some
of the field forms have formatting applied to dates & currencies. When I
populate the document programmatically, the field formats I need
aren't applied until I manually tab through the doc. I tried the code below
but it doesn't do the trick.
TIA,
Eric
Private Sub TabThruForm(doc As Word.Document)
Dim k As Integer
Dim frmFlds As Word.FormFields
Set frmFlds = doc.FormFields
For k = 1 To frmFlds.Count
If k <> frmFlds.Count Then frmFlds(k).Next.Select
Next k
frmFlds(1).Select
End Sub Tag: how do I add scripts to my word doc? Tag: 108998
adv: Design reports in Word
This is a bit off-topic but should be of interest to auite a few here.
If you are looking for a reporting solution where you can design the reports
in MS Office (which is a lot faster) - please take a look at Windward.
Windward Reports, the leader in enterprise report generation, has released
the worldâ??s first enterprise reporting software that enables use of Excel as
a design tool. The Windward Reports Server Engine is perfect for users
creating both java reports and .net reports alike, and now allows users to
design reports in both Microsoft Word and Microsoft Excel as well.
Windward, a leader in with its design-in-Word reporting software because of
its ease of use, now adds the advantages of Excel to its portfolio of
simple-to-use, superior reporting products. Windwardâ??s new AutoTag 6.0
reporting software uniquely uses Excel to intelligently figure out sums and
number formatting, and allows users to build a table which supports
calculations. AutoTag 6.0 still outputs to Word, or any other output format,
to produce reporting documents.
Why is this Excel release so important? Simply put: Freedom. By creating an
easy-to-use design tool which allows users to design their reports in Excel
(in addition to word), Windward is freeing up thousands of IT man-hours
normally allocated to report design, and including Excel business users in
their â??power-to the peopleâ?? philosophy. Now, non-technical business users who
prefer Excel, can design their own reports and stay within their comfort zone
while doing so. Windward Reports AutoTag for Excel doesnâ??t just look like
Excel, it IS Excel.
How Does It Work? Begin with a worksheet. Using the AutoTag pull-down menu,
select a data source such as an SQL database or XML file. (AutoTag works in
conjunction with the Windward Reports Standard Server Engine, which gives
your PC the ability to communicate with your organization's data sources,
such as its SQL databases and XML files.) You use standard Excel commands to
format and edit the report, and you assign tags to the data fields using the
AutoTag pull-down menu. When finished, you save your template and, if you
wish, verify that tags are correct with AutoTag's "validate" function.
What makes this unique? With AutoTag for Excel, your number formatting
always carries through â?? it doesnâ??t matter if you output to RTF, PDF, or any
other type. And, by using Excel templates you have a way to easily, and
automatically generate reports that perform calculations on a collection of
values! For instance, you might use Excel to sum all of the line-item
amounts that are generated by an AutoTag. While AutoTag was always easy to
use, this additional capability offers functions not available in a
word-designed template, allowing the software to be used by more people, in
more ways.
When you generate the report Windward Reports merges this template with the
data you have selected. The finished report, with all of your formatting,
positioning and design, is available in minutes instead of hours or even days.
Download a demo or check out a sample report at
http://www.windwardreports.com. For more information on how you can use Excel
or Word to design your reports, call 303-499-2544. Tag: how do I add scripts to my word doc? Tag: 108997
Excel cell reference in Word Macro
I have an Excel Spreadsheet that contains some information and I'am try to
reference to one cell in the Excel workbook. This cell needs to be entered
into a New Word document Macro so I can go to our Company Intranet and open
the word document that contains the information I need. The information
needed form our Intranet is to be copied and entered into a New Word documeny
that is to be printed.
Example of code.
e = Excel cell
of = "http//www.psc.uss.com/documents/ECP/02/01/" & e & ".doc"
Documents. Open FileName:=of
The above works when I put the Excel cell information in the Macro. I can
then copy all the information needed and the rest of the Macro runs fine.
I am new at writting code for Word, but do a good job of Excel code.
Please help.
Thanks,
ekreider Tag: how do I add scripts to my word doc? Tag: 108993
help! email attachment is blank
I've created a document template with a userform. When I pull up a new
document, I want to be able to "fill in the blanks" on the user form, update
the document, and have it sent automatically to a specific email address. I'm
using Word 2003 and Groupwise. So far so good ... it sends the document to
my email, but when I open the document from my email, it is a new - blank -
document, not document with saved information. Here is the code I'm using:
Private Sub Commandok_Click()
Application.ScreenUpdating = False
With ActiveDocument
.Bookmarks("text1").Range.Text = TextBox1.Value
.Bookmarks("text2").Range.Text = TextBox2.Value
.Bookmarks("text3").Range.Text = TextBox3.Value
End With
Application.ScreenUpdating = True
Unload Me
Temp = ActiveDocument.Name
'Open a GroupWare session Object
Set GWApp = CreateObject("NovellGroupWareSession") ' login to GW
'Login using () will login to the open account or run the login
'script if none was opened.
Set gWAccount = GWApp.Login()
'Create a new message in the Mailbox
Set gwMessage = gWAccount.MailBox.Messages.Add
gwMessage.Subject = "Complaint Form"
gwMessage.BodyText = "Please review the enclosed complaint form"
gwMessage.Recipients.Add "nikolatv@ah.org"
gwMessage.Attachments.Add Temp 'Add an open workbook to the attachments
gwMessage.Send 'Send out
MsgBox ("Your message been successfully sent!")
ActiveDocument.Close
End Sub
I'm missing something, somewhere ... any help at all would be MUCH appreciated Tag: how do I add scripts to my word doc? Tag: 108984
Table Cell Data AddIn
I just posted a modification of my Table Cell Data Addin to my website:
http://gregmaxey.mvps.org/Table_Cell_Data_Word2007.htm
This version is for Word2007 and it uses Ribbon customization to display the
data in a "Table Information" tab that I added to the Table Tools tab.
I think it is pretty neat, but I am just a dabbler in XML and I am not sure
if there will be any ill effects of using the Ribbon in this perhaps
unconventional manner. I would appreciate any thoughts or advice on that
matter.
Secondly, if you download the Addin and look at the code, you will see that
I had a problem suppressing the display of the calculation results. My goal
is to show the results only after the Calculate button is depressed, but
then hide that label (e.g., set it to "") when the selection is moved. The
problem is with the value that the .Calculate method returns. It is a
Single and if the value is bogus (e.g., attempts to calculate a selection of
letters) it returns still returns 0. As a work around I picked a relatively
unique number .000000009000000001 and set the Calculation result label to ""
if the result of the calculation is .00000000090000000001. This of course
means that if the actual value of a calculated selection is
.00000000090000000001then the label will not display the answer. I am
looking for a way to set the Calculation result button to "" initially and
then reset it to "" when the selection is moved.
Thanks.
--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word. Tag: how do I add scripts to my word doc? Tag: 108983
cancel a macro in progress
Are there shortcut keys that will safely cancel a macro in progress? I am
speaking of macros that ask the user for input (i.e. a number or date).
Sometimes the people I support realize they chose to run the wrong macro or
otherwise want to stop the one they started. I want to give them a safe way
to cancelling the macro in progress that will still be available to them at a
future time.
Any ideas would be appreciated. Tag: how do I add scripts to my word doc? Tag: 108982
Update Text In All Footers
Hi Everyone,
I have a VB macro that I need to add something to. I am trying to amend the
text in all footers.
I need the text to show:
"Document Title v1.0 " & "_" & PNAME & "_" & PCODE & ".doc"
where PNAME and PCODE have already been defined earlier.
Can anyone help?
Thanks! :)
Dave Tag: how do I add scripts to my word doc? Tag: 108979
go to last page of the document -word 2003
Hi,
I'm trying to program a macro. One of the steps is to go to end of document
and change the header.
I'm unable to find the command (or write the program) to go to last page of
the document. (I don't have number of pages neither bookmarks)
Thanks
--
meme Tag: how do I add scripts to my word doc? Tag: 108970
I would like to add jscript to my Word document. Is this possible?