Command Bars
All of the sudden, one of my computers running the same VBA program that I
successfully run on 10 other computers has stopped creating Command Bars.
The code is:
Set mybar = CommandBars.Add(name:="MyNewBar", Position:=msoBarFloating,
Temporary:=True)
Is there a setting in the registry that anyone knows of that may have been
corrupted?
Thanks
-Ed (in Virginia) Tag: Re: Creating a Macro that will only print the current page Tag: 115792
Macros for Microsoft Excel Worksheet in Microsoft Word Document
This is a multi-part message in MIME format.
------=_NextPart_000_00B4_01C8E86C.D07F6120
Content-Type: text/plain;
charset="windows-1251"
Content-Transfer-Encoding: quoted-printable
Hello,
Using macros in Microsoft Word, how is it possible to:
1) Set the number of rows and columns for Microsoft Excel WorkSheet?
2) Put the values into the cells of Microsoft Excel WorkSheet?
Recording macros in Microsoft Word gives the following code:
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 7/17/2008 by
'
Selection.InlineShapes.AddOLEObject ClassType:=3D"Excel.Sheet.8", =
LinkToFile _
:=3DFalse, DisplayAsIcon:=3DFalse
End Sub
Sincerely,
Aleksander
------=_NextPart_000_00B4_01C8E86C.D07F6120
Content-Type: text/html;
charset="windows-1251"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1251">
<META content=3D"MSHTML 6.00.2900.2912" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD><FONT face=3DArial><FONT size=3D2>
<BODY>
<DIV><FONT size=3D2>
<DIV>
<DIV>Hello,</DIV>
<DIV> </DIV>
<DIV>
<DIV class=3Dpostcolor>Using macros in Microsoft Word, how is it =
possible=20
to:<BR><BR>1) Set the number of rows and columns =
for Microsoft=20
Excel WorkSheet?<BR>2) Put the values into the cells =
of Microsoft=20
Excel WorkSheet?<BR><BR>Recording macros in Microsoft Word gives =
the=20
following code:<BR><BR>
<DIV>
<DIV id=3DCODE=20
title=3D"=CF=EE=E4=F1=E2=E5=F2=EA=E0 =F1=E8=ED=F2=E0=EA=F1=E8=F1=E0 =
=E4=EE=F1=F2=F3=EF=ED=E0 =
=E7=E0=F0=E5=E3=E8=F1=F2=F0=E8=F0=EE=E2=E0=ED=ED=FB=EC =
=F3=F7=E0=F1=F2=ED=E8=EA=E0=EC =
=D4=EE=F0=F3=EC=E0.">Sub Macro1()<BR>'<BR>' Macro1 Macro<B=
R>' Macro recorded 7/17/2008 by<BR>'<BR> &=
nbsp; Selection.InlineShapes.AddOLEObject ClassType:=3D"Excel.S=
heet.8", LinkToFile _<BR> &n=
bsp; :=3DFalse, DisplayAsIcon:=3DFalse<BR>End Sub</DIV>
<DIV=20
title=3D"=CF=EE=E4=F1=E2=E5=F2=EA=E0 =F1=E8=ED=F2=E0=EA=F1=E8=F1=E0 =
=E4=EE=F1=F2=F3=EF=ED=E0 =
=E7=E0=F0=E5=E3=E8=F1=F2=F0=E8=F0=EE=E2=E0=ED=ED=FB=EC =
=F3=F7=E0=F1=F2=ED=E8=EA=E0=EC =D4=EE=F0=F3=EC=E0."> </DIV>
<DIV=20
title=3D"=CF=EE=E4=F1=E2=E5=F2=EA=E0 =F1=E8=ED=F2=E0=EA=F1=E8=F1=E0 =
=E4=EE=F1=F2=F3=EF=ED=E0 =
=E7=E0=F0=E5=E3=E8=F1=F2=F0=E8=F0=EE=E2=E0=ED=ED=FB=EC =
=F3=F7=E0=F1=F2=ED=E8=EA=E0=EC =D4=EE=F0=F3=EC=E0.">Sincerely,</DIV>
<DIV=20
title=3D"=CF=EE=E4=F1=E2=E5=F2=EA=E0 =F1=E8=ED=F2=E0=EA=F1=E8=F1=E0 =
=E4=EE=F1=F2=F3=EF=ED=E0 =
=E7=E0=F0=E5=E3=E8=F1=F2=F0=E8=F0=EE=E2=E0=ED=ED=FB=EC =
=F3=F7=E0=F1=F2=ED=E8=EA=E0=EC =
=D4=EE=F0=F3=EC=E0.">Aleksander</DIV></DIV></DIV></DIV></DIV></FONT></DIV=
></BODY></HTML></FONT></FONT>
------=_NextPart_000_00B4_01C8E86C.D07F6120-- Tag: Re: Creating a Macro that will only print the current page Tag: 115788
acquerir achat zocor us usa soft achat zocor canada belgique Acheter achat zocor canada en ligne sur internet achat zocor belgique commande en ligne generique medicaments us usa
acquerir achat zocor us usa soft achat zocor canada belgique Acheter achat zocor canada en ligne sur internet achat zocor belgique commande en ligne generique medicaments us usa
+++ Cholestérol +++ Cholestérol +++ Cholestérol ++
ACHETER ZOCOR BON MARCHE (ALL CARDS ACCEPTED !!!
http://jhku.net/ACHETER-ZOCOR-BON-MARCHE
http://jhku.net/ACHETER-ZOCOR-BON-MARCHE
ACHETER LIPITOR BON MARCHE (ALL CARDS ACCEPTED !!!
http://jhku.net/ACHETER-LIPITOR-BON-MARCHE
http://jhku.net/ACHETER-LIPITOR-BON-MARCHE
http://ibm-news.for-um.de/showthread.php?t=1178
commander zocor canada par mai
commander zocor en France en lign
acheter zocor bon marche Sans Prescriptio
achat zocor suiss
acheter zocor canada zocor de Simvastati
commander zocor sof
acheter zocor belgique soft en lign
achat zocor canada zocor de Simvastati
acheter zocor belgique commande en lign
acheter zocor belgique par emai
achat zocor belgique bon marche Sans Prescriptio
pharmacie en ligne us us
achat zocor suisse sans ordonnanc
solucion Cholestérol canad
achat zocor canada zocor de Simvastati
Achat acheter zocor canada franc
commander zocor en ligne aucune prescriptio
zocor de canada bon march
achat zocor suisse au rabais en ligne sans prescriptio
achat zocor belgique Generique Ind
acheter zocor canada soft en lign
acheter zocor belgique bon march
achat zocor canada pharmaci
Achetez Le acheter zocor canad
acheter zocor canada zocor de Simvastati
Acheter acheter zocor en ligne sur Webacheterenlign
acheter zocor suisse commande en lign
Achat acheter zocor franc
zocor de Simvastatin bon march
achat zocor suisse en lign
acheter du achat zocor cin
Acheter acheter zocor en ligne sur interne
acheter zocor belgique au rabais en ligne sans prescriptio
achat zocor canada soft generiqu
achat acheter zocor canada discre
generique pharmacie us usa Tag: Re: Creating a Macro that will only print the current page Tag: 115783
VBA IDE Settings stored where?
Hi
Does anybody know where the IDE Options setting are stored. Specifically the
Editor Format ones.
I've looked in the Registry but can't find it.
Any ideas?
Cheers
Dave F. Tag: Re: Creating a Macro that will only print the current page Tag: 115776
Set Word 2007 default font values from VS2005
Hello all.
Can anybody help. I have a VS2005 Word addin and would like to set words
default font values as shown when the addin starts. In the code below I
cannot work out what is to replace the ??????. Can anybody help?
Imports Extensibility
Imports System.Runtime.InteropServices
Imports Microsoft.Office.Core
Imports Word = Microsoft.Office.Interop.Word
-----------------------------------------------------------
Sub Onstartup()
With applicationObject.ActiveDocument.Styles(?????.wdStyleNormal).font()
.Name = "Arial"
.Size = 11
.Bold = False
'etc...
End With
End sub Tag: Re: Creating a Macro that will only print the current page Tag: 115774
Problem with commenting highlighted words in tables
Hi,
In long documents I work with (several 100 pages), I need to highlight
words that need to be reviewed. I do this using vba code. Next the
user has to navigate from one highlighted text to another for review.
To enable this I tried using the following code lines before the macro
for highlighting the words:
ActiveDocument.TrackRevisions = True
ActiveDocument.ShowRevisions = True
( I used these lines on the assumption that trackrevisions would track
the words that would be highlighted by the code that followed).
As this did not work, I used the following code on the document to
comment the highlighted words with comment text being the same as the
highlighted text:
Sub AddCommentstoHighlights()
Dim oDoc As Document
Dim s As String
With Selection
.HomeKey Unit:=wdStory
With .Find
.ClearFormatting
.Text = ""
.Highlight = True
Do While .Execute
Selection.Comments.Add Selection.Range,
Selection.Text
Loop
End With
End With
End Sub
The reason was commenting the highlighted text was to enable the Track
changes feature for navigating betweenn the highlighted text (that
would now get commented)
This worked fine and was meeting my requirements till it encountered a
document where the table had a highlighted cell. It failed at the line
starting with "Selection.Comments" stating that the object was not
supported end of table row or something similar. What would be the fix
for this?
Is there any other way of navigating between highlighted words in a
document that mimics the functionality offerred by the Track changes
feature?
Thanks in advance for all the help.
Regards,
Raj Tag: Re: Creating a Macro that will only print the current page Tag: 115770
insertfile and section breaks
Hi, All --
I have a VBA program that inserts a file into the active document.
This file might have a section break at the end, and if it does, it
might be a page section break, or a continuous section break.
But invariably, when the file is inserted using selection.insertfile,
the section break becomes a page section break, no matter what kind of
section break it was in the original file. Does anyone know why this
is and what can be done to stop this from happening (or a workaround
to "transparently" correct it after the fact)? I need the type of the
section break to be maintained after the file insertion.
TIA--
--larry Tag: Re: Creating a Macro that will only print the current page Tag: 115769
Working with Content Controls
I'm an advanced Excel user now trying to get to grips with Word.
I have created a structured document using Content Controls as the only user
editable fields. I want to link some controls which contain common data. e.g.
when the user enters the client name in a control, all the client name
controls are updated.
I couldn't work out an easy way to do this so resorted to VBA. Then within
VBA, I couldn't work out how to reference a single content control so that I
could use ClickOnExit just for that control.
Please can anyone help me? Tag: Re: Creating a Macro that will only print the current page Tag: 115767
Detecting partial contents in an array
Hi,
I have a 2-dimensional array associated to a table. The array contains the
same data that's in the table and in the same order.
Column 9 contains data like: "CI, HGP, MI" or any combination and
permutation of these three words, but there's always at least one of them.
Is it possible to detect whether a particular cell in Column 9 of the array
CONTAINS one of these words in particular. Just to clarify, I'm not trying to
read the whole content of the cell, so reading directly from array(i,j) does
not work. I need something like:
If array(i,j) contains "HGP" then ....
In this case, even if the actual content of array(i,j) is "MI, HGP" and not
exactly "HGP", it'll go through the if.
I know there's is not such a thing as contains, but I'm asking if there's a
way to accomplish what this would do.
Thank you Tag: Re: Creating a Macro that will only print the current page Tag: 115759
Searching for a variable bookmark name
I have multiple bookmarks in a document that all begin with "ABC...". The
"..." can be any combination of letters and numbers at varying lenghts. Is
there a way to search for all bookmarks within the document that begin with
"ABC" using VBA? Once found, the bookmark will be deleted. I'm using Word
2007. Please let me know if more info is needed. Thank you!! Tag: Re: Creating a Macro that will only print the current page Tag: 115758
Dynamical creation of forms
Hello,
I'am used to work with PHP and MySQL on webbased application.
I have to make for my colleagues a program that have to follow a few
dessistions (path) like a flowchart.
The result shood be a word document from about, 150-250 pages. The
chapters are, depending of the anwsers in the virtuel flowchart.
Afterwoods there are more then 100 fields automaticaly filled in from
excel tabels. What qind of fields are depending of the flow in the
chart.
I have tried in VBA but the forms are fixed. You have to pre-deffine
the forms. Difficult to initiate.
Easy to merge different chapters. Layout is automaticaly ok.
Communication with excel works fine.
I don't know how I have to start. Choosing the write language VBA
(word,excel) , VB, C++, PHP with MySQL ???
My knowledge of PHP and MySQL is mutch bether.
I would like to work like in PHP but I can't make any communication
with Word or Excell.
Someone an idea, hint, tip, sugestion Tag: Re: Creating a Macro that will only print the current page Tag: 115755
Text alignment in MultiPage
Hi,
The default alignment in Multipages seems to be centre . How do I change the
alignment to left?
// Ulf Tag: Re: Creating a Macro that will only print the current page Tag: 115754
Export all Excel sheets in a folder to access master table using V
Hi,
I have 700 excel sheets in a folder. All excel sheets contains same fields.
I want to move all the sheets to access database. The tables is already
created. I want to move it using VBA. Can someone help me with the code
please?
I also want to add the file name of the sheet to a additional field in the
same table. Please Help... Thanks. Tag: Re: Creating a Macro that will only print the current page Tag: 115750
making form to perform calculations
I am trying to make a field in my form to make a calculation of body surface
area. The user inputs height and weight into the neighboring fields
Height: inches Weight: lbs BSA
and i would like then BSA filled in automatically filled using formula:
BSA (m²) = ( [Height(in) x Weight(lbs) ]/ 3131 )½ and then have a cursor
move to the next input field.
Is it possible? I know nothing about VBA programming and this is the only
sophisticated step i have in my form, hardly worth mastering VBA.
Can anyone suggest solution?
Thank you in advance
Dotkor Tag: Re: Creating a Macro that will only print the current page Tag: 115741
Adding comments to different words using vba
Hi,
I have a word document that contains words shown in the vba array
below.
The array of words in vba code are as follows ("May", "July",
"September")
I am looking for a solution where comments are added to each
occurrence of a word in the array. The comment would need to be
conditional. eg. For June the comment should have the text "Form 24
filing", For July, "IT Return Filing", for September, "Quarter
ending".
Thanks in advance for the help.
Regards,
Raj Tag: Re: Creating a Macro that will only print the current page Tag: 115739
header, footer, body
Hi
Can someone tell me how to copy the header, footer, and body of a page
into separate variables or separate files if possible. I also need to
maintain the fomat of these three sections exactly as they are. I can
access the header and footer but i am having so much trouble in terms
of saving and using them when I need to.
thank you
mona Tag: Re: Creating a Macro that will only print the current page Tag: 115724
MkDir command doesn't work 2nd time
I am creating a Word 2003 template with a userform where multiple product
specifications can be selected from a list box. Elsewhere in the form, the
user also chooses what project the specifications are for, along with what
department (Engineering, Plumbing, etc., for example) is requesting them.
Upon clicking OK, an existing Word document containing those specifications
is found, opened, updated, then saved to that projectâ??s Spec subfolder in a
subfolder of Spec based on the department. As an example, if the spec is
called Steel Reinforcement, the project is ABC Waterpark (which has a folder
on our P: drive) and the requesting department is Engineering, clicking OK
will save the resulting Word document to this location:
P:\ABC Waterpark\Specs\Engineering\Steel Reinforcement.doc.
Iâ??ve written most of the code to do this. However, hereâ??s my glitch: For
the several hundred projects on our P: drive, most do not have a Specs
subfolder (and consequently, no departmental subfolder(s) like Engineering
either). Iâ??m trying to use the MkDir command to create them when necessary.
If there is no Specs subfolder, my MkDir code below successfully creates it.
But if an Engineering (or any other department) subfolder needs creating
after the Spec folder is, I get a run-time error 4172 Path Not Found. Funny
thing is, if I go into the Immediate Window and run the MkDir command, it
works! Any thoughts on why the second MkDir command results in an error?
I'm sure my code can be vastly improved. Thanks for any suggestions you can
give me!
Sub SaveSelectedSpec (Path, SpecName, RequestingDept)
' Called by: Private Sub cmdOK_Click
' Purpose: Saves all documents selected in opening form to a departmental
' subfolder within the desired P: drive projectâ??s Specs subfolder. If Specs
does not
â?? exist, create it first, then also create the appropriate departmental
subfolder of
' Specs to place the selected Word Document in.
â?? Coming into this procedure, the above variable values are as follows:
â?? Path = â??20080050 â?? ABC Waterparkâ?? (all projects have a folder on our P:
drive)
â?? SpecName = â??Steel Reinforcement.docâ??
â?? RequestingDept = â??Engineeringâ??
On Error GoTo NoSpecsFolder
â?? if Specs folder doesnâ??t exist, error will execute code to create one
' (this is working as desired)
ChangeFileOpenDirectory "P:\" & Path & "\Specs\ "
GoTo CreateSubDept â?? if Specs folder exists, then create the department
subfolder
NoSpecsFolder:
'Creates a new Specs folder if none currently exists
MkDir "P:\" & Path & "\Specs\" â?? again, this command works as desired
CreateSubDept:
On Error GoTo NoDeptFolder â?? if the Requesting Dept. subfolder does not
exist,
' error will execute code to create one
ChangeFileOpenDirectory "P:\" & Path & "\Specs\" & RequestingDept & "\"
â??this is
' where the run-time error 4172 Path Not Found pops up, rather than going to
the
' NoDeptFolder command line. At this point, I can paste the MkDir command
below
' into the Immediate Window, and it works! But why not here???
GoTo SaveDoc â?? if dept. folder exists, then save document there
NoDeptFolder: 'Creates a new Dept subfolder withing Specs if none exists
MkDir "P:\" & Path & "\Specs\Specs\" & RequestingDept & "\"
SaveDoc:
ActiveDocument.SaveAs FileName:= _
SpecName, FileFormat:= _
wdFormatDocument, LockComments:=False, Password:="",
AddToRecentFiles:= _
True, WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts:= _
False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
Exit Sub
End Sub
--
Steve C Tag: Re: Creating a Macro that will only print the current page Tag: 115718
Suppress Prompt
I have created a macro that performs some actions & then closes the active
file. I would like to suppress the prompt that appears when the file closes
"Do you want to save the changes to Document X?" (ie close the file without
saving any changes) Is this possible? If so, how? Tag: Re: Creating a Macro that will only print the current page Tag: 115716
Using Open Statement
Hi,
I'm trying to export data from Excel to a text file using the open statement.
My problem is that I have to create multiple files using some of the data
itself to make up the file name. I can get the basic functionality to work
and have used it before but haven't had any luck inserting variables for the
filename itself.
I can't find any documentation that specifically states it's possible or not
possible but I haven't found any examples either.
No matter what variation I try, I get a bad file name error.
Here's the code I'm using:
vFilename = vInternalExternal & "-" & vLastName4Char & "-" & vAdNumber & "-"
& vDateTime & "-" & vRequistionNumber & ".txt"
vFullFilename = ActiveWorkbook.Path & vFilename
Open vFullFilename For Append As #1
Print #1, vAllFields
Close #1
Any thoughts would be appreciated.
Thanks Tag: Re: Creating a Macro that will only print the current page Tag: 115714
Setting DocumentProperties in Word 2007 using vb.Net ASPX Page
Hi All,
I'm having trouble updating the DocumentProperties in Word 2007. I'm trying
to use an ASPX page writte in VB.NET update the 'Subject' property in a
document. All the methods I've seen suggest something like this:
Dim oWord As New Word.Application
Dim oDoc As Microsoft.Office.Interop.Word.Document
Dim properties As Microsoft.Office.Core.DocumentProperties
oDoc = oWord.Documents.Open("C:\Templates\Saves\Time Table.DOC")
properties = DirectCast(oDoc.BuiltInDocumentProperties, _
Microsoft.Office.Core.DocumentProperties)
properties.Item("Subject").Value = "Test"
However, I get the following error on the DirectCast line:
Unable to cast COM object of type 'System.__ComObject' to interface type
'Microsoft.Office.Core.DocumentProperties'. This ope
ration failed because the QueryInterface call on the COM component for the
interface with IID '{2DF8D04D-5BFA-101B-BDE5-00AA0
044DE52}' failed due to the following error: No such interface supported
(Exception from HRESULT: 0x80004002 (E_NOINTERFACE))
Can anyone suggest an article or a solution to this problem?
Thanks in advance,
Kenny Tag: Re: Creating a Macro that will only print the current page Tag: 115713
Word 2007: Add button to location other than AddIns tab.
VBA apparently knows how to add a button or a drop down list to the Word
2007 AddIns tab in reponse to 'legacy' (Word2003) VBA code. I have figured
out how to create a new tab in the 2007 ribbon called "My Program" but I
cannot figure out how to add the button and dropdown lists that so easily
appear in the AddIns tab to appear over in the "MyProgram" tab. Is there a
way to do this?
-Ed (in Virginia) Tag: Re: Creating a Macro that will only print the current page Tag: 115707
changing excel links from automatic to manual update
well, that's the question: how do i programmatically change a given link to
excel from automatic updating to manual updating (the recorder doesn't catch
any of the key strokes) Tag: Re: Creating a Macro that will only print the current page Tag: 115705
Specify Criteria for Mail Merge Recipients
I would like to change the following macro so that it selects only those
people in the data source that do NOT have an email address (ie Email =
blank). Any suggestions? I will also need to know how to change it back to
Email = All.
Thanks!
Sub PrintMerge()
'
With ActiveDocument.MailMerge
.Destination = wdSendToPrinter
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
End With
End Sub Tag: Re: Creating a Macro that will only print the current page Tag: 115703
Catching the New Page event in VBA
I am developing an MS Word (xp) template for a corporate letterhead that will
automatically insert the reference number (already stored in a variable from
the first page) into the header of the second (and subsequent) pages.
I am aware that there is no "new page" event in Word that can be caught.
The solution I am working on involves checking the
'ActiveDocument.BuiltInDocumentProperties("number of pages")' property and
running the code as soon as the page number has incremented. Unfortunately, I
cannot find a way of checking this value each time the user types a new
character.
Here is the code I am using at this time :
Option Explicit
Private WithEvents wdApp As Word.Application
Dim page1 As Integer
Dim page2 As Integer
'This line is executed during the loading of the document
page1 = ActiveDocument.BuiltInDocumentProperties("number of pages")
Private Sub wdApp_WindowSelectionChange(ByVal Sel As Selection)
page2 = ActiveDocument.BuiltInDocumentProperties("number of pages")
If page2 > page1 Then
MsgBox "Now on page " & Format(page2)
'Do the necessary operation here...
.
.
.
End If
End Sub
Unfortunately, the above sub is only works when I click with the mouse
anywhere in the document.
I tried other subs from the same set and I thought that
'wdApp_DocumentChange()' would be the one to use, but this dosen't work
either.
Can anyone give me a pointer as to how I can trap the 'new character event'
(if there is one) and to check if the page number has changed ?
Any help will be greatly appreciated !
Many thanks,
--
Lars Tag: Re: Creating a Macro that will only print the current page Tag: 115694
Extracing info from one document while in another
If I am in a form document and entering data in formfields, is it possible to
extract info from a saved document to populate a few of the formfields?
I know the file path of the saved document.
Ideas....
Thanks,
Bryan Tag: Re: Creating a Macro that will only print the current page Tag: 115693
Removing disabled items in word 2007 (VBA)
Hi,
Does anybody know of a way to clear the disabled items list in Word 2007
using automation (i'm automating using Visual Studio 2005 vb.Net)?
Thanks in advance.
--
Kenny.
Systems Developer Tag: Re: Creating a Macro that will only print the current page Tag: 115692
Opening 2 documents in Axwebbrowser in Windows Application
C# - Visual Studio 2005 - Word 2003 - Windows XP
I have created a custom button and added it to the MS Word Standard Toolbar.
On clicking this button, i get a Windows Form that states weather the Current
active document is saved or not saved.
When i open any Word document in an AxwebBrowser object inside a Windows
Form, i find the standard toolbar and see my custom button. It works just
fine.
But when i run another instance of the Application and open another file in
the AxWebBrowser, i find that i am able to use the Custom button only in the
second instance of the application. In the Earlier(First instance) i am not
able to even click the button. No only that, all the buttons in the toolbar
do not seem to function at all(Bold...Italic...Allignment etc)
Why is this happening and how can i resolve it. Please help. Thankyou. Tag: Re: Creating a Macro that will only print the current page Tag: 115684
Form fields in a template
I have a variety of templates using form fields. I need to import specific
data into some of the form fields and the form needs to remain as a template
after the data is imported and separate templates need to be created after
the import. It must be locked for some sections as the user needs to be able
to fill-in the form fields. I have run into quite a few stumbling blocks.
I can't use a mail merge because it strips my field codes out that are not
being populated and the mail merge does not seem to work with templates.
Is there any other way I can populate form fields (or bookmarks) with data
from an excel workbook?
I did get one reply with a suggestion that is probably good for creating one
document, however, I didn't get a reply after providing the following
additional information. I need to take the one template and generate 500+
templates using records from an excel spreadsheet, (personalizing the
templates). Then the templates will be used by office staff to complete
online. Any ideas?
Thanks,
Mary Tag: Re: Creating a Macro that will only print the current page Tag: 115677
2007 templates
I'm using Word 2007. When I attempt to attach a custom template to my
document, I get a message that the template is in use and I'm given the
option of being notified when the file becomes available or opening a
"read-only" copy. However, the template is NOT in use.
If this template was stored in my start-up folder, I could understand
perhaps why I'd be getting this message since these are loaded every time you
open Word. But this is stored in my "user template" folder location.
Does anyone know why is this happening? Tag: Re: Creating a Macro that will only print the current page Tag: 115662
string parameters are too long?
Hi all,
I define some place holders ( like <<<place holder>>> in a doc file and to
replace the place holders with some texts from an excel file. when text
length become long then I am told "string parameters are too long", how long
is too long and how can I circumvent it ?
Clara
--
thank you so much for your help Tag: Re: Creating a Macro that will only print the current page Tag: 115660
Help with autoexec
I have a template that is saved on a sharepoint site and used by many
different people. Problem is when people open the template and add text, then
go to save, they inadvertently save the file as a .dot file.
I have a AutoNew macro that would force the file to be saved as a .doc. This
works if the file is opened directly from a directory, but it does not work
when opened from where it is a link on the sharepoint internet site.
Is there another way to force the file to save as a .doc? Or is there a
better way to do this? Below is the code for the AutoNew macro:
Sub AutoNew()
Dim sPath As String
sPath = Options.DefaultFilePath(Path:=wdDocumentsPath)
ChangeFileOpenDirectory sPath
On Error GoTo Cancelled
ActiveDocument.Save
Application.DefaultSaveFormat = ""
Exit Sub
Cancelled:
If Err.Number = 4198 Then
MsgBox "User Cancelled"
End If
End Sub Tag: Re: Creating a Macro that will only print the current page Tag: 115655
WORD SpellCheck, Add to Dictionary button
Is it possible to prgrammatically, such as in a macro, disable the Add to
Dictionary button in WORD's Spell checker?
Thanks Tag: Re: Creating a Macro that will only print the current page Tag: 115652
using for each to select sentences in a cell
Hi,
I have managed to find a work around to my current problem but I am
intrigued as to why this is happening.
Word 2003
I am extracting individual lines out of a Table cell and placing them
in a collection which i am placing in a user form to provide a user
interface.
Previously i would have iterated over the string until i found a
carriage return / line feed character but after discovering the joys
of the Word Range object (thanks to the contributions in this group!)
I thought there must be a much more elegant solution.
Which i thought would be along the lines of Tag: Re: Creating a Macro that will only print the current page Tag: 115647
Find each text box
I want a way for a user to find each text box in the main story of a
multi-section document - kind of like 'browse by object' for text boxes - so
they can see whether or not the box should be deleted.
I don't see the option for searching for shapes in find, and I don't want to
do anything with the text boxes except maybe select them if necessary.
Any suggestions would be most appreciated, but I'm not an experienced vba
writer so comments associate with the code would really help.
--
Thanks, Jen Tag: Re: Creating a Macro that will only print the current page Tag: 115640
Bookmark REF Field
I have a template with several Form Fields. I would like to put in a
FormField that is automatically filled in with data that comes form three
other bookmarks. this FormField is a Report ID. The Report ID would be made
up from three different Bookmarks/Fields that the user fills in, such as
UserInitials, FiscalYear and State. The Review ID would automatically update
to ELB2008CA after the user enters the data for UserInitials, FiscalYear and
State.
Does anyone know how I could do this?
Thanks
--
Eric the Rookie Tag: Re: Creating a Macro that will only print the current page Tag: 115635
Form Fields Reset
I have a template with several Form Fields, REF Text and a TOC. I have a
macro that updates all Fields on the tool bar that allows users to update
fields when the Doc is protected. But the Form fields get reset when the
user uses this macro. Please help.
Sub UpdateFields()
'
'
Dim oStory As Range
For Each oStory In ActiveDocument.StoryRanges
oStory.Fields.Update
If oStory.StoryType <> wdMainTextStory Then
While Not (oStory.NextStoryRange Is Nothing)
Set oStory = oStory.NextStoryRange
oStory.Fields.Update
Wend
End If
Next oStory
Set oStory = Nothing
End Sub
--
Thanks
Eric the Rookie Tag: Re: Creating a Macro that will only print the current page Tag: 115634
How to handle pressing button "Cancel" from InputBox?
Hello.
How to handle of pressing button "Cancel" from dialogue InputBox? In
my code when user press button "Cancel" dispaly Msgbox from cycle Do
While. I need to cancel all action. See my code:
Sub movePic()
Dim Message As String
On Error Resume Next
If Selection.Type = wdSelectionInlineShape Then
Selection.InlineShapes(1).ConvertToShape
End If
If Selection.Type = wdSelectionIP Then
MsgBox "Please select your image"
Else
Do While Message = ""
Message = InputBox("Please enter the number." & _
vbCr & "...", _
"Move image", "")
If Message = "" Then
MsgBox "Please enter the number"
End If
Loop
Selection.ShapeRange.IncrementLeft MillimetersToPoints(Message)
End If
End Sub
Thank you very much! Tag: Re: Creating a Macro that will only print the current page Tag: 115630
Word 2007 formatting from elements/fields disapear
L.s,
I use the Dutch version, so I hope I translated the menu's fine. Also i
wonder if this is the right group for this question?
I have made a template for users en put the new "besturingselementen"
elements where the user can put in text, in the template. I fount this on the
developer tab, group elements and then the new ones (not the old 2003 or
really old 1998).
I choose the element without formatting and set it up to "disappear" when
the user changes the default text. It works fine until here.
I want to mark the places where the user need to make changes, I mark the
default text which is in the field/element with the "yellow text marker". Now
the user can easily see where to make changes. What works really nice is that
when the user chances the text, the element AND the marking will disappear. I
don't know if this is intended or a "undocumented feature" but it's a great
option.
And now the big problem:
In my documents there are many elements when I change the marking for some
of them it's looking fine, but when a save, exit and reopen the file, the
marking for other elements is gone.
I tested for several hours but can't find some logic in it. I tried:
- change the marking in developer mode (yes/no). for the elements.
- In developer mode when changing the marking include/exclude the label
marking round the element (where the text you can put in as "label" is
placed).
- Give every element a unique label name
- etc.
It drives me really nut's, I can't find any logic.
Does anyone know a solution for this puzzle
Manny thanks
Peter Tag: Re: Creating a Macro that will only print the current page Tag: 115626
GetCaretPos can't get the correct value
When i call GetCaretPos in MS Word Addin, It always return's a same value.
When i Enable IME,it can return the correct value. Some one can tell me why? Tag: Re: Creating a Macro that will only print the current page Tag: 115625
Formatting seems to pass from Form Fields to repeated fields
Hi All
Again, I'm using Form textboxes to enable a user to enter repetitive info in
one place and then use ref fields to display this info in various places
such as textboxes, table cells, etc, when the user tabs out of the relevant
form textbox.
My problem is that the initial form textboxes are something like 16 pt bold,
which they need to be and for some reason this formatting also goes to the
repeating fields, which is no good because I want the repeating fields to
remain in their pre-set states of 10pt normal, 9pt normal, etc.
Any ideas how I stop the formatting coming across?
Thanks Tag: Re: Creating a Macro that will only print the current page Tag: 115609
How to auto-display the forms toolbar and a macro to click on
Hi All
Having real trouble finding out how to do this.
Basically I have done a Word doc that uses Form fields so that I can
auto-copy the contents of say 20 form fields into designated areas of the
remaining doc.
My problem is that textboxes don't seem to auto-update when the user has
tabbed out of a form field (cells in tables do), so I've a little VBA macro
function that goes through all of the references and forces them to update -
inc the textboxes.
My problem is that I need the user to click the padlock icon on the forms
toolbar to unlock the doc so that the user can then click on this macro to
run it.
This 'unclick padlock then click Macro' procedure has to be done for each
copy of the Word doc template that they use, but the user is fine with that.
My functional problem is that I:
a) Can't get the Forms toolbar to be already displayed when the user opens
the copy doc from the template.
b) Can't get my Macro to appear as a clickable toolbar/item/button when the
user opens the copy doc from the template.
Although displaying the Forms toolbar isn't too much of an onerous task for
the user, ie they go View / Toolbars / Forms, getting the Macro to appear on
the menu/toolbar is way too much hassle.
Is there no way, either via VBA or something even more simpler, I can get
these details to auto-display as the user opens the copy doc?
Thanks Tag: Re: Creating a Macro that will only print the current page Tag: 115608
Create Table of Changes
I have multiple people reviewing multiple copies of the same document.
I need to merge all reviewed documents into a final document wich will be
created by taking the original document and adding the suggestions / changes
added in the appropriate places.
I am an excel VBA programmer & so far I can make a table of revisions (using
track changes) and a table of comments, but am unsure how to tag their
original location so that I can put them all back where they came from.
I would prefer to use revisions (needs only to work for inserted revisions)
but I could use comments as well.
Any insight / help would be appreciated. Tag: Re: Creating a Macro that will only print the current page Tag: 115605
save email message
I am trying to create the following sub to save an email message as an Excel
file. The Sub does search through the outlook folder and saves the message as
"Daily Processing Report.xls", but I get an error when trying to open it,
"File Format invalid". I am able to do this manually by opening the message
and doing a file save as and typing "Daily Processing Report.xls" and it
opens just fine. But when I do it manually it also saves a folder with the
same name and in it it has two xml files and one file with .thmx extension. I
want to be able to do this with a macro if possible.
sub extractEmailMessage()
Dim olApp As outlook.Application
Dim olNs As outlook.NameSpace
Dim olFolder As outlook.Folder
Dim olItem As outlook.MailItem
Set olApp = CreateObject("Outlook.Application")
Set olNs = olApp.GetNamespace("MAPI")
Set olFolder = olNs.GetDefaultFolder(olFolderInbox).Folders("Folder")
dirname = "D:\Emails\"
For Each olItem In olFolder.Items
If olItem.Class = olMail Then
olItem.SaveAs dirname & "Daily Status Report.xls"
End If
Next
End Sub Tag: Re: Creating a Macro that will only print the current page Tag: 115604
Date Field Clear
sGood Afternoon,
After checking the previous posts, I didn't see anything that quite fit what
I'm looking to do and I'm hoping someone can still help. The first program
below fills in two different ranges in the doc (one with the user id and the
other with the date). Unfortunately, it was brought to my attention that
someone might be a drooling moron and click on the box by accident which
would require a clear function.
The second program I tried to set up works to clear the Text Range
(BMRange), but will not clear the Date Field (BMRange1). I've tried several
variations and the best I can come up with what's below where it only deletes
the first text character.
Any thoughts on how to get it to delete the whole date line?
Thanks in advance - Jenny B.
Sub Bookmark()
Dim BMRange As Range
Dim BMRange1 As Range
Application.ScreenUpdating = False
With ActiveDocument
If .ProtectionType <> wdNoProtection Then
.Unprotect Password:="1"
End If
End With
'Identify current Bookmark range and insert text
Set BMRange = ActiveDocument.Bookmarks("Div").Range
Set BMRange1 = ActiveDocument.Bookmarks("Divs").Range
BMRange.Text = Environ("username") & " " & "Dividends"
BMRange1.InsertDateTime datetimeformat:="MMMM dd, yyyy", InsertAsField:=False
'Re-insert the bookmark
ActiveDocument.Bookmarks.Add "Div", BMRange
ActiveDocument.Bookmarks.Add "Divs", BMRange1
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _
NoReset:=True, Password:="1"
Application.ScreenUpdating = True
End Sub
__________________
Sub Clearboxes()
Dim BMRange As Range
Dim BMRange1 As Range
If ActiveDocument.FormFields("Check19").CheckBox.Value = False Then
Set BMRange = ActiveDocument.Bookmarks("Div").Range
Set BMRange1 = ActiveDocument.Bookmarks("Divs").Range
BMRange.Text = ""
BMRange1.Delete
ActiveDocument.Bookmarks.Add "Div", BMRange
ActiveDocument.Bookmarks.Add "Divs", BMRange1
End If
End Sub Tag: Re: Creating a Macro that will only print the current page Tag: 115603
Dialog not opening for selection
I have the following code is a test document (.doc) and it opens the dialog
box fine for me to select an image folder.
'
' select the folder
'
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
If .Show Then
myFolder = .SelectedItems(1)
End If
MsgBox ("Folder selected is " & myFolder)
End With
However, when I place that same code in a Word template (.dot) I see the
MessageBox displayed but the dialog box never appeared prior to that for me
to select the folder.
What am I missing? I am trying this in Word 2002 (XP) on WinXP SP2.
Mainer Tag: Re: Creating a Macro that will only print the current page Tag: 115602
Reading SQL database and retrieving document
VBA gerus,
I need my macro to read the name of a document from an SQL database on
a remote site and retrieve the named document for editing. After
editing, I need a macro to write/rewrite the document to the site.
Can this be done using VBA? Are there samples of syntax? Thanks.
Charlie from Texas Tag: Re: Creating a Macro that will only print the current page Tag: 115600
Reading SQL database and retrieving a file
VBA Gerus,
From a macro, I need to read a document's name from a SQL database on
a remote site, and retrieve the document. After editing, a macro
needs write/overwrite the file back to the site. Can this be done
from VBA?
Thank you,
Charlie from Texas Tag: Re: Creating a Macro that will only print the current page Tag: 115599
Cloning document content to new docs
I'm using the Word Object Model to work with the body of a new e-mail
message in Outlook 2007. My goal is to simply clone the active e-mail into
one or more copies (the recipients from the source will each get their own
copy of the original, which will be trashed). I'm tried using
Document.Select, then Application.Copy on the source e-mail, followed by
Document.Activate, Document.Select (the Document objects are specific to the
cloned item, not the source), Application.Selection.WholeStory and then
Application.Selection.PasteAndFormat(wdPasteDefault) on each newly cloned
e-mail. However, there are times when I get a locked for editing warning
and the cloning fails - empty message body; this occurs inconsistently.
Is there a better approach to cloning the contents of a Document object in
situations like this where the documents are not file based?
--
Eric Legault [MVP - Outlook]
MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS 2007
& WSS 3.0 Application Development)
President
Collaborative Innovations
-> Try Picture Attachments Wizard 2.0 For Microsoft Outlook <-
-> Take your SharePoint content offline <-
-> More info: http://www.collaborativeinnovations.ca <-
Blog: http://blogs.officezealot.com/legault Tag: Re: Creating a Macro that will only print the current page Tag: 115593
how do you automatically generate a letter on certain dates
bsd
I would like to automatically generate a birthday greeting letter in
word2000 to my friends a day before their birthdays wich I have a tendecy to
forget Tag: Re: Creating a Macro that will only print the current page Tag: 115591
To: Dorak,
Sub PrintCurrentPage()
Call ActiveDocument.PrintOut(Range:=wdPrintCurrentPage)
End Sub