Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-28-2014, 05:14 AM
rsrasc rsrasc is offline Need Help Creating Macro Windows 7 64bit Need Help Creating Macro Office 2010 64bit
Competent Performer
Need Help Creating Macro
 
Join Date: Mar 2014
Location: Germany
Posts: 141
rsrasc is on a distinguished road
Default Need Help Creating Macro

I have a file with the following format or information (listing over 100 hundred numbers)--I only include two as an example.



1. Which of the following best describes what is meant by the term crazy? a. Rules acknowledged by the profession. b. Pronouncements issued by the AA Board. c. Measures of the quality of the performance. d. Procedures to be used to gather to support. 2. For which of the following can a member of the AAA receive an automatic expulsion from the PPPP? a. I only. b. I and II only. c. I and III only. d. I, II, and III.

Here is how the information should look after applying the macro.

1. Which of the following best describes what is meant by the term crazy?

a. Rules acknowledged by the profession because of their universal application.
b. Pronouncements issued by the AA Board.
c. Measures of the quality of the performance.
d. Procedures to be used to gather to support.

2. For which of the following can a member of the AA receive an automatic expulsion from the PPPPA?

a. I only.
b. I and II only.
c. I and III only.
d. I, II, and III.

Thank you in advance for any help.
Reply With Quote
  #2  
Old 03-28-2014, 10:27 AM
gmaxey gmaxey is offline Need Help Creating Macro Windows 7 32bit Need Help Creating Macro Office 2010 (Version 14.0)
Word MVP 2003-2009
 
Join Date: May 2010
Location: Marble, NC
Posts: 1,006
gmaxey will become famous soon enoughgmaxey will become famous soon enough
Default

Here is one way:

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Word.Range
Dim lngIndex As Long
 Set oRng = ActiveDocument.Range
  For lngIndex = 2 To 150
    With oRng.Find
      .Text = lngIndex & ". "
      .Font.Bold = True
      While .Execute
        oRng.MoveStart wdCharacter, -1
        oRng.Characters(1) = vbCr
        oRng.Collapse wdCollapseEnd
      Wend
    End With
  Next lngIndex
  Set oRng = ActiveDocument.Range
  With oRng.Find
      .Text = " [abcd]."
      .MatchWildcards = True
      While .Execute
        oRng.Characters(1) = vbCr
        oRng.Collapse wdCollapseEnd
      Wend
    End With
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #3  
Old 03-28-2014, 12:58 PM
rsrasc rsrasc is offline Need Help Creating Macro Windows 7 64bit Need Help Creating Macro Office 2010 64bit
Competent Performer
Need Help Creating Macro
 
Join Date: Mar 2014
Location: Germany
Posts: 141
rsrasc is on a distinguished road
Default Need more assistance

Here is a sample of the output. It is separating all the [abcd] including number 1 and 2 but when it comes to number 3 it doesn't move the number to the left margin-not sure why. See number 12-is missing the one. The same with 22. Not bad at all. I would like to see a space between the question and letter a and letter d and the next question number.

It's a start, and looks good.



1. Which of the following is not generally a power of the board of directors of a corporation?
a. Selecting officers.
b. Declaring dividends.
c. Determining management compensation.
d. Amending the Articles of Incorporation.
2. Which of the following is not true concerning corporations?
a. Directors owe a fiduciary duty to the corporation.
b. All shareholders owe a fiduciary duty to the corporation.
c. Officers owe a fiduciary duty to the corporation.
d. Directors who act in good faith may use the business judgment rule as a defense.3. Which of the following is not a right of the shareholder of a corporation?
a. Right to inspect the books and records.
b. Right to share in dividends if declared.
c. Right to determine the mission of the corporation.
d. Right to sue on behalf of the corporation if the officers and directors fail to uphold corporate rights.4. Which of the following actions normally requires shareholder approval?
a. Appointing the chief executive officer.
b. Issuing a dividend.
c. The corporate strategic plan.
d. Changing the nature of the corporation.5. To which of the following rights is a stockholder of a public corporation entitled?
a. The right to have annual dividends declared and paid.
b. The right to vote for the election of officers.
c. The right to a reasonable inspection of corporate records.
d. The right to have the corporation issue a new class of stock.6. Which of the following is correct with respect to the rights of stockholders in a corporation?
a. Stockholders have no right to manage their corporation unless they are also directors or officers.
b. Stockholders have a right to receive dividends.
c. Stockholders have no right to inspect the books and records of their corporation.
d. Stockholders have a right to get a list of their corporation’s customers to use for a business mailing list.7. A corporate stockholder is entitled to which of the following rights?
a. Elect officers.
b. Receive annual dividends.
c. Approve dissolution.
d. Prevent corporate borrowing.8. Which of the following best identifies the reason that effective corporate governance is important?
a. The separation of ownership from management.
b. The goal of profit maximization.
c. Excess management compensation.
d. Lack of oversight by boards of directors.9. The articles of incorporation and bylaws of a corporation serve as a basis for the governance structure of a corporation. Which of the following items are normally included in the bylaws of the corporation as opposed to the articles of incorporation?
a. Purpose of the corporation.
b. Number of authorized shares of stock.
c. Procedure for electing directors.
d. Powers of the corporation.10. Which of the following forms of compensation would most likely align management’s behavior with the interests of the shareholders?
a. A fixed salary.
b. A salary plus a bonus based on current period net income.
c. A salary plus stock options that cannot be exercised for 10 years.
d. A salary plus stock.11. Which of the following forms of compensation would encourage management to take on excessive risk?
a. A fixed salary.
b. A salary and bonuses based on current period net income.
c. A salary plus stock options that cannot be exercised for 10 years.
d. A salary plus restricted stock.
2. Which of the following is not a duty that is typically reserved for the board of directors of a corporation?
a. Selection and removal of the chief executive officer.
b. Determining executive compensation.
c. Amending the articles of incorporation.
d. Decisions regarding declaration of dividends. 13. Which of the following is a legal rule that prevents directors from being held liable for making bad decisions if they act with good faith, loyalty, and due care?
a. The good faith rule.
b. The business judgment rule.
c. The due care rule.
d. The director liability rule.14. Which of the following is not a requirement of the New York Stock Exchange regarding corporate governance of companies listed on the exchange?
a. Have a majority of independent directors of the corporate board.
b. Adopt and make publicly available a code of conduct.
c. Prohibit the chief financial officer from serving on the board of directors.
d. Have an independent audit committee.15. Which of the following does not act as an external corporate governance mechanism?
a. External auditors.
b. The SEC.
c. Credit analysts.
d. Independent boards of directors. 16. The Sarbanes-Oxley Act provides that at least one member of the audit committee should be
a. Independent.
b. The chief financial officer of the company.
c. A financial expert.
d. A CPA.17. Which of the following is not a statutory requirement regarding the committees of the board of directors of publicly held corporations registered with the SEC?
a. All members of the compensation committee must be independent.
b. At least one member of the compensation committee must be a “compensation expert.”
c. All members of the audit committee must be independent.
d. At least one member of the audit committee must be a “financial expert.18. Which of the following is necessary to be an audit committee financial expert according to the criteria specified in the Sarbanes-Oxley Act of 2002?
a. An understanding of income tax law.
b. An understanding of generally accepted accounting principles and financial statements.
c. An understanding of corporate law.
d. An understanding of corporate governance rules and procedures.19. Which of the following is not a requirement of the Wall Street Reform and Consumer Protection (Dodd-Frank) Act for publicly held corporations registered with the SEC?
a. If it is decided that the CEO should also be appointed chairman of the board, the corporation must disclose why this decision was made.
b. The members of the compensation committee of the board must be independent.
c. Shareholders must be allowed a nonbinding vote on officer compensation at least every three years.
d. All members of the audit committee of the board must be financial experts. 20. Which of the following is most effective as an external monitoring device for a publicly held corporation than the others?
a. Internal auditors.
b. External auditors.
c. The SEC.
d. Attorneys.21. An important corporate governance mechanism is the internal audit function. For good corporate governance, the chief internal audit executive should have direct communication to the audit committee and report to
a. The chief financial officer.
b. The chief executive officer.
c. The controller.
d. The external auditors.
2. In setting priorities for internal audit activities, the chief audit executive should
a. Use a risk-based approach.
b. Use management’s priorities.
c. Use an approach that cycles audit areas each year.
d. Use a random approach to more likely detect fraud.
Reply With Quote
  #4  
Old 03-28-2014, 01:04 PM
macropod's Avatar
macropod macropod is offline Need Help Creating Macro Windows 7 32bit Need Help Creating Macro Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,925
macropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud of
Default

Another way:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
  .InsertBefore " "
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchWildcards = True
    .Text = ".([0-9]{1,3}.)"
    .Replacement.Text = ". \1"
    .Execute Replace:=wdReplaceAll
    .Text = " ([a-e].)"
    .Replacement.Text = "^p\1"
    .Execute Replace:=wdReplaceAll
    .Replacement.Style = "Strong"
    .Text = " ([0-9]{1,3}.)"
    .Execute Replace:=wdReplaceAll
  End With
  .Characters.First.Delete
End With
Application.ScreenUpdating = True
End Sub
With the additional 3 lines after '.MatchWildcards = True', it'll handle the questions where the space was missing before the question number.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]

Last edited by macropod; 03-28-2014 at 01:10 PM. Reason: Additional code for malformed question spacing
Reply With Quote
  #5  
Old 03-28-2014, 01:15 PM
gmaxey gmaxey is offline Need Help Creating Macro Windows 7 32bit Need Help Creating Macro Office 2010 (Version 14.0)
Word MVP 2003-2009
 
Join Date: May 2010
Location: Marble, NC
Posts: 1,006
gmaxey will become famous soon enoughgmaxey will become famous soon enough
Default

The code is looking for a space before the numbers. In your example above there is no space between the period ending the last alpha enumerated number and the period before the Arabic number e.g., "fraud.23."
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #6  
Old 03-28-2014, 01:18 PM
macropod's Avatar
macropod macropod is offline Need Help Creating Macro Windows 7 32bit Need Help Creating Macro Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,925
macropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud of
Default

I've modified my macro to handle the malformed spacing. Try the updated version.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #7  
Old 03-28-2014, 01:31 PM
rsrasc rsrasc is offline Need Help Creating Macro Windows 7 64bit Need Help Creating Macro Office 2010 64bit
Competent Performer
Need Help Creating Macro
 
Join Date: Mar 2014
Location: Germany
Posts: 141
rsrasc is on a distinguished road
Default Well Done

I'm happy with the output now. It is working perfectly. Thank you both gmaxey and macropod.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help Creating Macro Creating a macro button in powerpoint Sammie0Sue PowerPoint 1 12-06-2013 05:51 AM
Need Help Creating Macro Creating a generic macro? suerose Word 2 07-04-2011 07:59 PM
Need Help Creating Macro Creating macro to convert/print to pdf shabbaranks Word 3 05-18-2011 08:59 AM
Creating a MACRO Nikb3522 Word VBA 0 10-21-2010 05:55 PM
creating macro steveb Word VBA 0 08-14-2010 01:29 AM


All times are GMT -7. The time now is 11:17 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft