Enable/disable macros when none in document
Hi
I created a document with some vba code in it for testing. Now that I
checked it works, I have put the code in normal.dot and removed the module
from this document. However, whenever I open it, I still get the macro virus
warning asking me whether I want to enable or disable macros. I don't get
this with other documents, so how do I stop it happening with this one
please?
(Word 97)
Thanks
GB Tag: timers help Tag: 98091
Form and Macro Problem
I currently have a problem that seems simple but is not in Word and don't
know if it can be done. I'd appreciate any feedback anyone here may have
that may clarify for me if this can even be done in Word and if not, I'm
pretty sure I can do it in Excel, but the person I'm working for wants it in
Word if possible.
What I have are 4 documents (forms). They are all similar in nature in that
they are all 2 column forms with the left column content always staying the
same except for the variable form fields that will change according to the
client selected, but the right column would be defined by a dropdown box in
the left column that when choosing one of the options from that box, the
right column would change content to the other form data.
In case I'm not stating this clearly, I have posted a jpg kind of laying out
what I need. If any more clarification needs to be made, just let me know.
This is a little out of my range, but was hoping that maybe using VB there
was a way to do this.
Here is the sample using 2 of the forms. The other two are similar in that
the left column stays the same so the information doesn't need to be
repeated from page to page. They do not want a 4 page document. I figured
out how to run a macro and import the information from another file into
that column, but once I assigned a macro to the drop down box selection, I
was no longer able to lock the form, which is crucial. I need the content
in the change order to change only in the right side of the page and was
hoping a macro or programming of some sort would allow me to do this in
Word. Now I do the macro assigned to a button and I get vb runtime errors.
http://www.eliteofficesupport.com/clients/sample/
Thanks for any direction or assistance,
Lily Tag: timers help Tag: 98086
Separate where there is "#"
Hey all,
Quick question I hope.
I have a word doc with two columns. We click a button to copy data out of a
program and then we paste it into the word doc. At a certain point in the
data there is a # which separates numerical data from the notes.
What I want to do is have the data separate at the #. The portion before
the # going to column 1 and the portion after going to column 2. Thanks very
much for any insight you can offer.
James O Tag: timers help Tag: 98085
Email from word...
This isn't the regular email from word question.
I use word 2003.
File > Send to > Mail recipent
Opens up an outlook style top bar,
I'd like to be able to make that appear using VBA, with the TO
dialogue filled in automatically from a textbox on my userform.
Is this possible?
This is what I'm talking about btw:
http://www.99cones.co.uk/outlook.jpg Tag: timers help Tag: 98082
dynamic drop downs
I trie d this code:
Private Sub Project_Change()
If Image.Text = "IPSD Base" Then
Project.List = Array("NA")
Else
If Image.Text = "CPSE Base" Then
Project.List = Array("NA")
Else
If Image.Text = "CPSE Development" Then
Project.List = Array(" ", "AMA", "ATHN", "Feller", "Future
Phoenix", "Janus", "K700", "KMS", "MEGA", "PSD", "SEBR")
End If
End If
End If
End Sub
It compiles ok, but is not dynamic. Basically, 2 drop down boxes,: "Image"
and "Project". I would like the choices in "Project" to be dependant on the
choice in "Image" Tag: timers help Tag: 98077
How do I search for a bulleted list?
I need to search for bulleted list items in a document, and replace them with
a specialized style. The items currently have no unique formatting or styles
attached to them. Is there some way to search for "bulleted list"? Tag: timers help Tag: 98073
Reading from closed excel file into word form and writing data to closed excel file
Hi,
Was wondering if anybody could help. In the Initialise_Form subroutine of a
word macro, I would like to read data (a number) from a single cell in
Excel, insert it as the caption of a label box (so that the data cannot be
altered by the user), then add 1 to the number in the cell in Excel and save
the worksheet, all without opening the worksheet. This will ensure that
each time the form is initialised, it will have a unique number. The reason
why I would like to use Excel is that there will be a number of users
initialising forms. I have seen the excellent tips on the MVP website (and
have used them to load a listbox from an excel range for another part of the
form), but cannot find anything directly on point. I would like to know
whether saving data to a closed Excel file can be done. Any help would be
appreciated.
Many thanks,
Kym Tag: timers help Tag: 98064
Hijacking a Word command
Greetings,
I want to make the ActiveDocument.SendMail command conditional when the
File>Send to>Mail recipient as attachment command is chosen.
How do I "hijack" it into a Word macro for conditional manipulation before
sending it to Outlook?
My purpose is give the party sending the doc an option to change the
template to Normal using the code
With ActiveDocument
.UpdateStylesOnOpen = False
.AttachedTemplate = "Normal"
End With
or to send it as is.
Thanks in advance,
Israel Dalven
Technical Writing
Flash Networks Tag: timers help Tag: 98060
Application.OrganizerCopy does not work correctly in Word 2007
Hi,
I would like to copy a format-template from a DOT-File into the
ActiveDocument.
In Word 2003 the folling VBA-Code works fine:
-----------------------------------------------------------------------------------------------
Sub TestOrganizerCopy()
source1 = Options.DefaultFilePath(wdProgramPath) & "\StartUp\DATA5.dot"
destination1 = ActiveDocument.FullName
Application.OrganizerCopy Source:=source1, Destination:=destination1,
Name:="AbsatzNummer", Object:=wdOrganizerObjectStyles
End Sub
-----------------------------------------------------------------------------------------------
In Word 2007 this code works also fine, but only if the ActiveDocument is
stored on the local filesystem.
If the ActiveDocument is stored somewhere on a fileserver the code produces
a error that tells you, that the active document is already open.
The system seems to block itself.
Does anybody know a solution, how to solve the problem?
Thanks for help.
Regards
Karl Zuern / DATA 5 GmbH Tag: timers help Tag: 98059
How to ceate in VBA a word table in a document tutorial for dummie
Hi,
I'm a dummy.
Is there somewhere a dummies guide to creating a table using VBA in a word
document that explains what you do and what is being done at each step.
I have a recordset i wish to place in a table with two columns centrally on
the page.
Fixed distance from the top columns so wide then merge the data into the
table.
I cannot find a how to for dummies anywhere.
There are examples etc but not what is actually being done.
Any pointers to web pages etc really appreciated so I can learn to do it
myself.
--
Regards
Bill Tag: timers help Tag: 98058
Office XP Professional Word 2002
My wife has Office XP Professional with Word 2002. Two weeks ago she noticed
that she no longer had the Edit tab in her Menu Bar as well as the Ruler was
now in Character spacing instead of inches. I have fixed the Ruler but have
not been able to restore the Edit tab inspite of running the Fix and Repair
proceedure in Help; using the Add/Remove/Change in the Control panel;
Un-install/install preceedure and replacing the Data file in the Registry. I
believe this happened during one of the updates but she does not remember
exactly when and did not establish a restore point. Any help is greatly
appreciated.
--
Henry Senior Tag: timers help Tag: 98054
Character by character search for direct formatting
Hi,
Forgive my ignorance but I am new to Word Programming.
I need to be able to search a document character by character. If the
Character is formatted as "Dark Blue" in colour I need to extract the
character from the source document to a new document (target) and continue
search and extract until the end of the source document is reached.
I know this request may sound a bit odd, so here's the reason why.
I've written a book (approximately 280000 words - 640 pages) and I want to
be able to extract just the Dialogue (enclosed by single quotation marks and
formatted in Dark blue, so that it stands out from the narrative)
The entire source document is written in font : Times New Roman, regular, 12
point
I have only used the "normal" paragraph style.
The situation is complicated by that the fact that only part of any given
paragraph may be dark blue (dialogue) which the rest is Black (narrative)
What I'm hoping for is a single target document that contains just the
dialogue (Dark Blue text)
Any thoughts on this conundrum would be much appreciated.
Mnay thanks Tag: timers help Tag: 98047
Protected text moves when I type into form
I have written a form in which I need to put information in the text
fields. I have protected the form, but the protected headings move as
I type the information in. This puts all the in out of sinc. The
headings move off of the line and down the page.
Thanks for any help. Tag: timers help Tag: 98043
Run Macro automatically when files get open
Dear Sir,
I have created macro name auto_open in word which finds & replaces text.
I wanted to run this macro at the time when file opens.
thnks
rupesh. Tag: timers help Tag: 98042
Is it possible to write a wizard in VBA
I'd like to use VBA to write a wizard that handles a series of conditionals.
If this then display that; with next and previous capability. Is this
possible in VBA please?
TIA
Philip Tag: timers help Tag: 98038
Search for textboxes
I recently moved a text box around in a word file and somehow it
disappeared. Can I ask Word to search for text boxes in a document via
VBA?
Help is appreciated. Thank you very much in advance.
Regards,
Andreas Tag: timers help Tag: 98027
Convert INCLUDEPICTURE text strings to Word fields with curly braces around the text string
Hi everyone
>From a Filemaker database, I produce a Word document with exam
questions.
Some of the questions have images (diagrams). A text reference for
each image arrives in the Word document as a paragraph, with the
content required for a linked picture field. For example:
INCLUDEPICTURE "http://www.homepage.mac.com/itraining/iQ/24487.jpg
What I need is a macro to run through the document and convert the
INCLUDEPICTURE text string to a proper field, so the image is viewable
in Word. I am hopeless at VBA and have been unable to nail this with
my very limited Macro skills. Basically I need the opening and closing
"curly braces" to encompass the text string. Three examples are shown
below with live images that are accessible via a web browser:
Question 10
INCLUDEPICTURE "http://www.homepage.mac.com/itraining/iQ/24487.jpg"
Question 11
INCLUDEPICTURE "http://www.homepage.mac.com/itraining/iQ/24405.jpg"
Question 12
INCLUDEPICTURE "http://www.homepage.mac.com/itraining/iQ/22031.gif"
Any help would be greatly appreciated.
Thanks in advance.
Michael Richards
Brisbane (Australia) Tag: timers help Tag: 98025
Text replacement
I have the following macro that finds the word â??Orderâ?? and changes it to all
caps and bold in the whole document. How do I change it to just replace it in
my ActiveDocument.Styles "Heading 1", "Heading 2", "Heading 3" and "Heading
4"?
Dim SearchRange As Range
Set SearchRange = ActiveDocument.Range
With SearchRange.Find
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Format = True
.Wrap = wdFindContinue
.Replacement.Font.Bold = True
.Text = "Order"
.Replacement.Text = "ORDER"
.Execute Replace:=wdReplaceAll
End With Tag: timers help Tag: 98023
Convert Table to OLE Word Document
Hello all,
I've got a VBA function that attempts to take a word table, select it,
cut it, and then create a Word OLE object where the table used to be,
then pastes the table into the Word OLE. I need this for a program I
work with that doesn't play nice with Word tables.
The code is below, and it works in Word 2003, but it will not work for
all tables in a larger document. I'm not sure why, and was wondering
if anyone had any ideas.
Thanks in advance!
Sub ConvertTablesToOLE()
'
'Move to top of document
Selection.GoTo What:=wdGoToPage, which:=wdGoToFirst
'Get count of tables
Dim tCount As Integer
Dim i As Integer
tCount = ActiveDocument.Tables.Count
i = 1
While i <= tCount
Selection.GoTo What:=wdGoToTable, which:=wdGoToNext 'go to first cell
of next table
Selection.MoveUp Count:=1
Selection.EndKey
Selection.TypeParagraph
Selection.MoveDown Count:=1
Selection.Tables(1).Range.Select
Selection.Cut
Selection.MoveUp Count:=1
'Create OLE, paste into it
Selection.InlineShapes.AddOLEObject ClassType:="Word.Document.8",
FileName _
:="", LinkToFile:=False, DisplayAsIcon:=False
ActiveWindow.Selection.Paste
ActiveWindow.Close
i = i + 1
tCount = ActiveDocument.Tables.Count 'We now have one less table, so
tCount gets updated
Wend
End Sub Tag: timers help Tag: 98018
Auto-Prompts for Form
I have a fax cover sheet that I created using Word 2003. I want to set up
prompts that would prompt the user with a dialog bog and then he/she would
fill in the appropriate information and then it would populate the
corresponding portion of the form. Does anyone know where I can find a
tutorial for this task?
Thank you in advance, Karen Tag: timers help Tag: 98013
Saving data from forms created in 2003 in 2007 version
In 2003 - you could extract data from forms using requesting to "save data
only" and then save the file as a plain text document - Data was saved and
separated by commas for easy export to other programs - I can NOT seem to get
this to work in the 2007 version - Any assistance would be greatly
appreciated. Thanks Tag: timers help Tag: 98008
Skip Compile
Hello
OS: Windows XP
App:Word XP
Can I mark a section of VBA that will not be compiled?
Why? I want to include Word 2003 Compatibility Options in a Word 2002 Tool.
[Application.Version] will determine what code is run. Ideally
if Application.Version = 11 then
Compatilitity = 2002
ElseIf Application.Version = 12
Compatilitity = 2003
etc.
Any assistance will be greatly appreciated.
Regards
Mike Tag: timers help Tag: 97989
regexp question
hi all
it's me again
In my vba program, I've created an new regexp called "reg"
the program will match the first paragraph in the active doc using the
reg.test
the program is how should I write the pattern to match "Chapter X"
I try the pattern "Chapter[ ][0-9]"
but it will also match a line like "Chapter 3342545435342543543543"
how should I tell regexp that it's end line??
I've try another like pattern "Chapter[ ][0-9]\n" , pattern "Chapter[
][0-9]^13"
but they cant match anything
many thanks Tag: timers help Tag: 97985
Highlight Numbering
In WordPerfect we had the ability to highlight our procedure numbering when
we would make a minor change to it. An example would as follows:
1.0 Procedure 1
1.1 This procedure tells...
The 1.1 could be highlighted in Yellow if there was a minor change to the
text in that step. 1.0 is Heading 1, 1.1 is Heading 2 and so on. Is there a
way to do this in Word? Tag: timers help Tag: 97977
Password dialog interferes with auto open macro
Hi,
I'm getting a problem that I believe is caused by a document's
password dialog. When I try to open the doc, I get the password
box and I get an error dialog saying the requested command could
not be performed because a dialog box is open.
Then, when I enter the doc, the macro executes twice, rather than
the once it should.
The macro in question simply goes to the end of the file and
inserts some blank paragraphs and the date or time. Now it does
that twice.
This didn't happen before I recently reinstalled Windows on a
reformat.
I suppose the way around this is to make the macro wait on the
password box or file painting. Or maybe someone knows a more root
solution.
Thanks for any input.
Paul
--
Using Office 2003 on Windows XP Home Tag: timers help Tag: 97975
"corrupt" normal.dot
I recently installed Office2003Pro to replace Office97Pro on a Dell Dimension
4550 P4 2.5GHz computer running WinXPHomeSP1. The normal.dot file from
Word97 contained several macros that I can no longer use because I am no
longer with my former employer; the macros I am particularly these were
primarily macros to print on different LAN printers.
I have tried to remove these macros and have ended up with alternative
versions of normal.dot listed in the project pane when I switch to VB. When
I try to view these, I get the following message: Project Locked Project is
Unviewable. In addition, it will note allow me to delete these projects.
How can I force it to delete these unwanted projects??
I have copied and pasted a a "fresh" copy of normal.dot from another
(laptop) computer, but when I launch Word2003 on my desktop, I still get the
same VB page!!??
Thanks for your help. Tag: timers help Tag: 97973
Err sending WD emailthru XL VBA-F8 OK, F5 not??
I'm using the following code in Excel VBA to create a Word doc, paste
in an Excel range copied as Picture, and save and send the doc as an
attachment. Because of our email system, it must go as an attachment.
When I step through with F8, everything is fine. When I use F5,
though, I get down to the PageSetup lines and get this error:
Run Time Error 462
The remote server machine does not exist or is unavailable.
If anyone has any suggestions or a better method, I would appreciate
all input.
Thank you.
Ed
(PS - Yes, a real email address was used in the test and went through
fine - with F8, that is.)
**********************************
Sub SendUpdate()
Dim wb As Workbook
Dim wk As Worksheet
Dim rng As Range
Dim x As Long, y As Long
Set wb = ActiveWorkbook
Set wk = wb.Sheets(1)
y = wk.Range("E65536").End(xlUp).Row
x = 20
Do
x = x + 1
wk.Range("G" & x).Select
If wk.Range("G" & x).Text <> "" Then Exit Do
Loop
ActiveWindow.ScrollRow = x
wk.Range("A16:J" & y).Select
Set rng = Selection
rng.CopyPicture
Dim WD As Word.Application
Dim doc As Word.Document
Dim WDrng As Word.Range
Set WD = New Word.Application
Set doc = WD.Documents.Add
doc.ActiveWindow.Visible = True
With doc.PageSetup
.Orientation = wdOrientLandscape
.TopMargin = InchesToPoints(0.75)
.BottomMargin = InchesToPoints(0.75)
.LeftMargin = InchesToPoints(0.5)
.RightMargin = InchesToPoints(0.5)
End With
doc.Content = "These due as of " & _
Format(Date, "dd-mmm-yy") & "; " & _
Format(Time, "hhmm") & " MST" & vbCrLf & vbCrLf
Set WDrng = doc.Paragraphs(doc.Paragraphs.Count).Range
WDrng.Paste
doc.SaveAs "C:\test.doc"
' Turn off spell check to avoid errors
doc.SpellingChecked = True
doc.HasRoutingSlip = True
With doc.RoutingSlip
.Subject = "Update"
.message = "Here is the current status."
.AddRecipient "me@notarealaddress.com"
.Delivery = wdAllAtOnce
End With
doc.Route
doc.Save
doc.Close
WD.Quit
wk.Range("C21").Select
End Sub Tag: timers help Tag: 97968
Selection.Find.Found returns true after all items have been found
Hi,
We recently migrated from Word 2000 to Word 2003. We have a ton of VBA code
that we use in house and are finding some issues between the two versions.
We have code that looks through a document and finds italic, bold, etc. and
wraps the text with codes similar to HTML (we're coding for InDesign and
Ventura)
When running a coding macro to tag italic formatting on a document that has
tables I found that Selection.Find.Found returns true, and the macro
continues to run, even though we've found and tagged all the italic.
'These are the tags we're adding for italic
startcode$ = "<I>"
endocde$ = "<I*>"
'First I set up the search:
With Selection.Find
.ClearFormatting
.Font.Italic = True
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
'Then I execute the search
Selection.Find.execute
While Selection.Find.Found
ActiveDocument.UndoClear
Selection.MoveLeft wdCharacter, 1 'start of the italic
string
Selection.TypeText startcode$ 'add the startcode
If Len(startcode$) <> 0 Then
'go back over the startcode and set it to default
para font
Selection.MoveLeft wdCharacter, Len(startcode$),
wdExtend
Selection.Style = "Default Paragraph Font"
Selection.MoveRight wdCharacter, 1
'we're back at the start of the italic string
Selection.Find.Execute
'puts the cursor at the end of the string
Selection.MoveRight wdCharacter, 1
'we're at the end of the italic string
Selection.TypeText Text:=endcode$ 'add the
end code
If Len(endcode$) <> 0 Then
'swipe the end code and set it to default para
Selection.MoveLeft wdCharacter, Len(endcode$),
wdExtend
Selection.Style = "Default Paragraph Font"
Selection.MoveRight wdCharacter, 1
'we're at the end of the endcode, ready to look for
more italic
End If
Selection.Find.Execute
'when we hit the last of the italic Selection.Find in
Word 2000, selection.find.found = false and we exit the loop, but in 2003
it's true, but when the search executes again the cursor stays put and keeps
on typing startcode$ and endcode$ over and over as infinitum.
Wend
I can't turn off the italic (what if it's bold and italic, then I need to
come back and do bold.)
If I run this on a document with no tables it works fine.
Any help would be most appreciated!!
Thanks in advance,
Steven Lee
Vaporloop - Technology Solutions for Small Businesses Tag: timers help Tag: 97965
How to add the data entered in a userform into a Text Form field
Hi,
I am very new to VBA, and word macros ( learning with the help of this forum
and Diane Chapman's tutorials).
I created a userform and want to populate the contents of a text Form field
on the word form with data entered in the userform.
How do I do it?
Essentially how do I append the values to the textForm field from the
userform?
Plz let me know if I need to explain what I am trying to do mor eclearly,
Thanks for your help
Sujit Tag: timers help Tag: 97964
Background Color and Normal.dot
Greetings,
With the addition of the background color property I have found that setting
the background to dark and the font color to light makes reading much easier
on the eyes. Unfortunately, I am a little on the lazy side so I wish to have
Word (2007) do this automatically everytime I open or create a new document.
I figured that starting with new would be easiest, so in Normal.dot>New
Module I put an AutoNew macro that changed the bakground color and text to my
liking. It works when executed from the immediate window, but not on
loading. I am at a bit of a loss. Isn't the AutoNew event handler supposed
to execute when a new document is created using the selected (In this case
Normal.dot) template?
Cory Tag: timers help Tag: 97955
A Global Variable Over Multiple Modules
I have a set of macros in multiple modules and would like to set a global
variable to be used by all these modules. If I define a global variable
within a module, all the macros in that module can see it but other modules
can't see it. How can I define a variable that can be used across multiple
modules? Tag: timers help Tag: 97954
Limit a CommandBar Button Availability in Word
I have added a commandbar button to my Word document and it works. However,
I want my button only visible in a subset of my open Word windows. How can
I turn the button visible for one group of Word windows and invisible for
others? I have tried using the WindowActivate and WindowDeactivate. The
deactivate does turn it off when I leave the window, but the Activate turns
it on whenever I go to a different Word window.
Thanks for any help.
Private Sub AppEventHandler_WindowActivate(ByVal Doc As Document, ByVal Wn
As Window)
Dim oMenuBar As CommandBar
Dim I As Integer
Set oMenuBar = CommandBars.Item("Standard")
For I = 1 To oMenuBar.Controls.Count
If I > 28 Then
I = I
End If
If oMenuBar.Controls(I).Caption = "&" + Hdr Then '"&MyGoTo" Then
'oMenuBar.Controls(I).Delete
oMenuBar.Controls(I).Visible = True
Exit For
End If
Next I
End Sub
Private Sub AppEventHandler_WindowDeactivate(ByVal Doc As Document, ByVal Wn
As Window)
Dim oMenuBar As CommandBar
Dim I As Integer
Set oMenuBar = CommandBars.Item("Standard")
For I = 1 To oMenuBar.Controls.Count
If I > 28 Then
I = I
End If
If oMenuBar.Controls(I).Caption = "&" + Hdr Then '"&MyGoTo" Then
'oMenuBar.Controls(I).Delete
oMenuBar.Controls(I).Visible = False
Exit For
End If
Next I
End Sub Tag: timers help Tag: 97952
Using prior version self-cert Digital Certificates in Office 2007
We have a number of "applets" that use Word and Excel (VBA and macros) to
function. These applets were originally designed in Office 2000 and 2003
using the self-certification tool included with those versions to sign them
for use in higher security environments where macro security is enabled.
They currently function in those environments without error or issue.
We are currently setting up our first Vista Workstation (running Ultimate
32-bit) and have discovered that Office 2007 treats our self-certified
applets differently than prior versions. Via the official Office website, we
learned that if macro security is enabled in Office, our self-certified
applets can only run macros if the digital certificate is added to the
Personal certificates folder. When we install our certificate via the
facility through Office 2007, it is placed in the "Intermediate Certification
Authorities" folder, not Personal. Exporting the certificate from the
"Intermediate" folder and importing it into the Personal folder results in a
"certificate imported successfully" message. However, the certificate does
not actually appear in the Personal folder and macros are not enabled on the
applets when executed.
Finally, we've found that creating a digital certificate using the
self-certification tool included with Office 2007 does allow us to import the
resulting cert file into the Personal certificates folder. Is it correct
that we will have to re-open and re-sign all of our self-certified applets
within Office 2007 for macros to be enabled properly? If so, what of our
clients that are using older versions of Office for which the applets were
originally designed? Is there any backwards compatibility between Office
2007 self-cert digital certificates and older versions of Office? Will we
have to maintain two different versions of the applets with two different
self-cert digital certificates?
Any help or information would be greatly appreciated.
Thanks,
Neil Dittmar
Software Developer
Aurora Information Systems Tag: timers help Tag: 97949
This document failed to print message
Hi folks,
We've got a printer that gets jobs that can be hundreds of letters to
customers. When the printer runs out of paper, it will pop a message
up on the print server that reads, "This document failed to print".
Yet when we put more paper in, it seems to continue where it left
off.
Is it possible that it actually will drop pages out of the print job?
Thanks,
Cole Tag: timers help Tag: 97939
Importing HTML table into Word 2003
Hi,
Here's what I'm trying to do. I have several JSP pages that creates HTML
tables as output. I use Document.Open to pull this HTML table into a
temporary word document. After that I use InsertFile to import that temporary
word document into the actual document I'm working on (I do this to prevent
memory issues on some of my larger tables).
Anyway, the problem I'm facing is, if one of the cells in the table has
either a greater than (>) or less than (<) symbol, the text gets truncated
from that character onwards. For example, if the cell text is:
Fever (in the absence of neutropenia, where neutropenia is defined as ANC
<1.0 x 10e9/L)
What gets imported into word is:
Fever (in the absence of neutropenia, where neutropenia is defined as ANC
Why is that? Why am I loosing the < character and everything after it? Is
there a way I can circumvent this? Is there a Word Patch? I'm not an expert
VBA programmer. This does not happen if I call the JSP page outside in
Internet Explorer. It opens up fine and displays all the text but in Word I'm
loosing half of the text.
Any help is greatly appreciated,
Thanks
Alex Tag: timers help Tag: 97938
Create RTF file in VBA to include formatting?
Howdy- I searched this group for possible answers, but couldn't find
relevant hits.
My company uses an MS Excel file to collect information about labor
elements in a proposal response. Part of this process is to generate a
printable summary of that information. Excel can do the job, but I'm
sure I can do it better if I create an RTF file in VBA and write
summary data to it, then save it as an RTF to open in Word.
I've written the code to generate the RTF file from Excel. My question
is: can I include commands in my code that instruct Word to use a
particular font, headers, footers, etc.? Is it possible to write Excel
VBA code to generate a .DOC file directly that would include
appropriate formatting?
I'm experienced with Excel VBA and have written some Word VBA code,
and I'd appreciate your thoughts- is there a site I can visit to get
smart on this in a hurry?
Thanks,
Dave O Tag: timers help Tag: 97937
Rearranging Table Columns
I have been playing around with some code to rearrange the columns of
a table.
E.g. existing data in a five column table
GRID NAME A B C D
1 2 3 4
Move column 5 before column 3. Then end result:
GRID NAME A D C B
1 4 3 2
I know (or think I know that you can't set a range = to a column so I
figured the best approach would be to write the data from the source
column (column 5) to an array. Add a new column before column 3.
Write the array results into the new column 3 and then delete the
source columne (now column 5).
Here is the basic code (stripped of error handling, etc.):
Sub ScrachMacroII()
Dim bProcess As Boolean
Dim myArray1() As String
Dim oCol1 As Long
Dim oCol2 As Long
Dim oTbl As Word.Table
Dim i As Long
Dim pStr1 As String
Dim newCol As Column
Dim lngLS As Long
bProcess = True
Do While bProcess
oCol1 = InputBox("Move column: ", "Source Column")
oCol2 = InputBox("Before column: ", "New Location")
On Error GoTo 0
For Each oTbl In ActiveDocument.Tables
If InStr(oTbl.Cell(1, 1).Range.Text, "GRID NAME") <> 0 Then
i = oTbl.Rows.Count
ReDim myArray1(i)
For i = 1 To oTbl.Rows.Count
pStr1 = oTbl.Cell(i, oCol1).Range.Text
myArray1(i - 1) = Left(pStr1, Len(pStr1) - 2)
Next i
Set newCol = oTbl.Columns.Add(BeforeColumn:=oTbl.Columns(oCol2))
lngLS = newCol.Next.Borders(wdBorderRight).LineStyle
newCol.Borders(wdBorderRight).LineStyle = lngLS
For i = 1 To oTbl.Rows.Count
oTbl.Cell(i, oCol2).Range.Text = myArray1(i - 1)
Next i
oTbl.Columns(oCol1 + 1).Delete
End If
Next oTbl
If MsgBox("Do you want to continue with another move?", _
vbQuestion + vbYesNo, "Continue?") = vbNo Then
bProcess = False
End If
Loop
Exit Sub
End Sub
I am just wondering if I have attempted to reinvent the wheel and if
there is a better, more simplified approach.
Thanks. Tag: timers help Tag: 97935
A section that appears or disappears
Hey all,
This sounds so simple, but is complete doing my head in!
I have a word VBA file, that on open, a form pops up and the user
fills in the details.
It then populates 2 files with said information, and copys important
information to the clipboard - thus saving a lot of time.
I'm using textboxes in tables on the word file and textboxes on the
userform.
However, there is a section that may not apply to everybody, and I
don't want the user to have to delete it if it doesn't apply - I'd
like my program to do that for him. If this section isn't applicable
to the specific client, I'd like to be able to remove it with a check
box - and for the rest of the file to "move up" as to not leave a
massive space in the document.
Anyone know this, it sounds simple, but I can't figure it out!
Cheers,
Rich Tag: timers help Tag: 97933
Autotext text and table, keep formatting
I've got a Table placeholder which has looks similar to this:
Table Title (specific paragraph style applied)
table here, one column, one row, character style applied
Source: (specific paragraph style applied)
I can't seem to get the formatting for the last line "Source" to keep it's
formatting. I've tried choosing the paragraph mark before and after the
text, but it just changes the "Source" line to Normal font (default).
Any suggestions from anyone?
/Under the gun.... Tag: timers help Tag: 97930
MSXML2
Trying to write code that will write to an xmlfile and replace values for
DocType, LanguageCode and. The xml contains other xml tags as well but they
should not be overwritten. My example xml file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<GDAInfo>
<System>
<DocType>1</DocType>
<ActiveSection>senad</ActiveSection>
<LanguageCode>SE</LanguageCode>
<UseTitle>False</UseTitle>
<NatDirectNumber>08-</NatDirectNumber>
<IntDirectNumber>+46 8 </IntDirectNumber>
</System>
</GDAInfo>
Managed to load and get info from xml file but to write to a certain tag in
the xml file.
Public Sub LoadXml()
Set oXml = New MSXML2.DOMDocument
oXml.async = False
If Not oXml.Load(GetXmlFilename()) Then
MsgBox oXml.parseError.reason
Exit Sub
End If
End Sub Tag: timers help Tag: 97929
How to open multiple instances of MSWord through VB
Hi
I want to open MS Word document through VB 6.0 and i am using
shellExecute API
sub command1_click()
Rtn = ShellExecute(frmName.hwnd, "Open", "C:\Program Files\Microsoft
Office\OFFICE11\WINWORD.EXE" , " C:\Program Files\Proj\sheets
\DocName.doc", "", 5)
end sub
when i click the command1 button then word document DocName.doc opens.
that's fine. again when i click the command1 button then same document
which was already opend is shown.But I want to to open multiple
instances of the same document. If i click command1 button 5 times
then 5 instances should open separately and then obviously close
separately. Our requirement is that 4 out of that 5 instances should
be read only ?
It should be noted that same API works fine for opening multiple
instances of MSExcel documents.
Regards
Imi Tag: timers help Tag: 97921
Debug Clear
Hello
OS: Windows XP
Apps: Office XP
Does anyone know how to clear the immediate Window using VBA ie. 'Debug.clear'
Any suggestions would be appreciated. I understand that closing Word will
clear it but I am looking for a VBA option.
Regards
Mike Tag: timers help Tag: 97920
Recording macros in Word 2007
I have begun using Word 2007, usually in compatibility mode. I find that when
I record a macro and assign to a keystroke combination, it only works in some
documents. Many of my macros are simply "assign a style" macro or something
equally simple just because I don't like to go to the mouse for repetitive
actions. Often, I get the "debug-cancel" message. When I recorded macros in
2003, they usually worked across all documents based on templates I had
created.
When I re-record a macro that is not working in the present document, it
asks if I want to replace the existing one with the same name. It clearly
knows the macro is there. Why won't it run in documents? Is there a
specification I can make when I record a macro so that it will be universal?
Thanks in advance. Tag: timers help Tag: 97908
Macro that will create a new directory?
I'm trying to write a Word macro that will create a new directory on my C:
drive. Is this even possible? Tag: timers help Tag: 97898
USPS Barcodes
I recently had need to send mail to an individual at USPS ZIP+4 address. I
addressed a single label using Word and printed it. I later had cause to use
the Merge feature to create multiple labels and happened to include in the
Excel database the same identical ZIP+4 address! I was very surprised to
find that the postal barcode it generated was DIFFERENT (in the last 16 bars
short/tall)! I then tried my own barcode (75248-3060) with the same
experiment and lo, it too generated two diferent barcodes! Anyone guess why? Tag: timers help Tag: 97896
Testing for blank pasges in document
Hi,
Is there a way to loop through each page in a document to test if it is
blank (ignoring header/footer) and if it is blank to remove the page?
Thanks. Tag: timers help Tag: 97880
Conditional Compilation
I am aware that there are no conditional compilation constants after
VBA6 to distinguish between versions of Word. I have also read items
like the following workarounds:
> What you can do is place all the office 2007-specific code into separate modules, If no code in that module is ever called when the template is used in Word 2003, then the template will run OK.
The problem I'm having is that either this doesn't work or I'm missing
something. I have a module called Word2003 that contains only the
following:
Sub TurnOffReading()
Options.AllowReadingMode = False
End Sub
I call it like this:
If Left(Application.Version, 2) >= "11" And
Left(System.OperatingSystem, 3) = "Win" Then
Word2003.TurnOffReading
End If
I still get the message "Compilation error in hidden module" when
running this in earlier versions of Word. Tag: timers help Tag: 97877
Delete paragraphs in active document?
I have a collections letter that 1) thanks the recipient for verbal agreement
to payment plan in paragraph1 and then 2) askes the client to sign and return
a promissory note in paragrah 2.
I'd like to deleted paragraph 2, paragraph 10 (the enclosure line), and page
2 (the enclosure) if the author does not want the promissory note.
I've set up a form that has 3 buttons: Cancel, Letter Only, and
Letter+Promissory Note.
The Letter only button passes txt values to bookmarks, and I'd like it to
delete text as shown above. It's not ActiveDocument.Paragrah.2.Delete; it's
not anything I've tried so far. Please help, VBA masters!
If I'm going about this entirely wrong, I want to know. If I just need to
read a key webpage, I'll take a link. I've googled endlessly and can't find
it.
Thanks in advance!
Sandi Tag: timers help Tag: 97875
does anyone know how to insert a clock or timer in a word form document so
users can see a basic stop watch
Answered elsewhere. Don't pepper the forums like this.
"johne" <johne@discussions.microsoft.com> wrote in message
news:836C2898-AA1C-4D87-BE91-6192200516E4@microsoft.com...
> does anyone know how to insert a clock or timer in a word form document so
> users can see a basic stop watch