473,396 Members | 1,840 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Run Macro made in MS Word.

Hi
I have made a macro in ms word.
Corresspondning this macro a form is associated, and on RUN of this macro operation is performed.

Now i need to make this macro available as a tool in ms word for any number of files, such that when i install this macro and associated form in any machine, i should be able to do operation.

How can i make a macro available as TOOL.

Please provide any solution.

Regards,
VkAgrawal
Feb 25 '07 #1
3 2788
willakawill
1,646 1GB
Hi. Do you mean by Tool to make a vb app that anyone can install and run? If that is the case please post the code that you have so far and let us know where you are stuck. Thanks
Feb 25 '07 #2
Hi. Do you mean by Tool to make a vb app that anyone can install and run? If that is the case please post the code that you have so far and let us know where you are stuck. Thanks
Hi

This is the code and it used Test Director addins, which i have installed in may machine.
do you need FORM also which i have made.

Expand|Select|Wrap|Line Numbers
  1. Public arr As Variant
  2. Public TableNo As Integer
  3.  
  4. Public Sub MAIN()
  5.  
  6.     Dim i As Integer
  7.     TableNo = 0
  8.     For i = 1 To ActiveDocument.Tables.Count
  9.         'Get input from user for FolderPath and Test case Name
  10.         TableNo = i
  11.         AutoTaggingForm.Show
  12.         Call AddBookmarks
  13.     Next
  14.  
  15.     TDWordAddin.ShowExportWizard
  16.  
  17. End Sub
  18.  
  19. Sub RemoveBookmarks()
  20.     Dim i As Integer
  21.     Dim arrBookmark() As String
  22.  
  23.     ReDim arrBookmark(ActiveDocument.Bookmarks.Count)
  24.     For i = 1 To ActiveDocument.Bookmarks.Count
  25.         arrBookmark(i) = ActiveDocument.Bookmarks(i).Name
  26.     Next
  27.     For i = 1 To UBound(arrBookmark)
  28.         ActiveDocument.Bookmarks(arrBookmark(i)).Delete
  29.     Next
  30.  
  31.     For i = 1 To UBound(arr) + 1
  32.         If Trim(ActiveDocument.Sentences(1).Text) = arr(UBound(arr)) & Chr(13) Then
  33.             ActiveDocument.Sentences(1).Delete
  34.             ActiveDocument.Sentences(1).Delete
  35.             Exit For
  36.         End If
  37.         ActiveDocument.Sentences(1).Delete
  38.     Next
  39.  
  40. End Sub
  41.  
  42. Sub AddBookmarks()
  43.  
  44.     Dim TotRows As Integer, i As Integer
  45.  
  46.     ' Adding Bookmarks for New steps
  47.     For TotRows = 2 To ActiveDocument.Tables(TableNo).Rows.Count
  48.         ThisDocument.Tables(TableNo).Cell(TotRows, 1).Select
  49.         If Trim(Selection.Text) = "" Then
  50.             MsgBox "Step name can't be empty", vbCritical
  51.             Call RemoveBookmarks
  52.             Exit Sub
  53.         End If
  54.         ActiveDocument.Bookmarks.Add Name:="CreateNewStep" & TotRows - 1
  55.         ThisDocument.Tables(TableNo).Cell(TotRows, 2).Select
  56.         ActiveDocument.Bookmarks.Add Name:="StepDescription" & TotRows - 1
  57.         ThisDocument.Tables(TableNo).Cell(TotRows, 3).Select
  58.         ActiveDocument.Bookmarks.Add Name:="ExpectedResult" & TotRows - 1
  59.     Next
  60.  
  61.     ActiveDocument.Tables(TableNo).Select
  62.     Selection.EndKey Unit:=wdStory
  63.     For i = 0 To UBound(arr)
  64.         Selection.TypeParagraph
  65.         Selection.Bookmarks.Add Name:="CloseTestFolder" & i
  66.     Next
  67. End Sub

Regards,
VkAgrawal
Feb 25 '07 #3
willakawill
1,646 1GB
Ok you can do this in vb and create a stand alone application that you can install on any pc. You need to use ms word automation which will be similar to what you have done here.

this is similar to what you have done and will start you off
Feb 25 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

25
by: Andrew Dalke | last post by:
Here's a proposed Q&A for the FAQ based on a couple recent threads. Appropriate comments appreciated X.Y: Why doesn't Python have macros like in Lisp or Scheme? Before answering that, a...
0
by: Colin Steadman | last post by:
Apoligies if this post appears twice, but my first attempt at posting it was hours ago and there is still no sign of it in the forum (says five minutes in the confirmation message). ...
1
by: Chasing Gates | last post by:
I have created a database that brings in a new table weekly. I then made a separate query for each sales rep and a separate report for each rep. (The reports are all identical but call different...
10
by: Brian Kwan | last post by:
Requirement: Call a Word Macro from ASP.NET with parameters Do anyone have idea about this? Please notice the import statement and sample code, as I am a beginner using ASP.NET, thanks for your...
3
by: Martin Austin | last post by:
Here's my problem. I'm launching an MS Word object on a Notes document Postopen event. The script kicks off a macro that saves the Word document to a temporary file every n minutes (backup of key...
5
by: Mason | last post by:
I'm having some problems converting VBA for Word 2000 to code that VB.Net understands. I recorded a macro in Word to add numbering (a. b. c.) to my paragraphs. I managed to translate quite a bit...
0
by: hinew | last post by:
Hi. I have created macro for Microsoft word. However I need this to be run in visual baisc application. I need a program that ask user to select the word document which need to be processed....
5
by: Bill | last post by:
This database has no forms. I am viewing an Access table in datasheet view. I'd like to execute a macro to execute a function (using "runcode"). In the function, I'll reading data from the record...
0
by: A1000ma | last post by:
I am trying to develop a C# program to fill in the blanks in a Word Form. Everything works beautifully while the program is running. I had to go in to fix some links on our Web Site a couple of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.