Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-18-2011, 10:46 PM
tays01s tays01s is offline VBA macros Mac OS X VBA macros Office for Mac 2011
Novice
VBA macros
 
Join Date: Jul 2011
Posts: 15
tays01s is on a distinguished road
Default VBA macros

Just started trialling 2011. Did a simple macro where I highlighted all then did some find/replace all operations. However, the latter did not occur or appear in the VBA code:


Sub Email()
'
' Email Macro
'
'
Selection.WholeStory
ActiveWindow.DocumentMapPercentWidth = 17
Selection.WholeStory
Selection.WholeStory
Selection.WholeStory
Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify
Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify
Selection.Font.Size = 9
Selection.Font.Name = "Arial"
End Sub

Why???
Reply With Quote
  #2  
Old 07-18-2011, 11:17 PM
macropod's Avatar
macropod macropod is offline VBA macros Windows 7 64bit VBA macros Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi tays01s,

Are you sure the macro recorder was on when you did the Find/Replace? If it was, the macro would probably be named 'Macro1' or something similar and would be placed in a code module named 'new macros' in either the document you're working on, or in Word's 'Normal' template, depending on the parameters you used when you did the recording.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 07-19-2011, 12:07 AM
tays01s tays01s is offline VBA macros Mac OS X VBA macros Office for Mac 2011
Novice
VBA macros
 
Join Date: Jul 2011
Posts: 15
tays01s is on a distinguished road
Default VBA macros

Positive.

Selection. Whole story.

came before the formatting as the end. The Find/Replace came after each:

Selection. Whole story.

Also I changed 'Macro1' to 'Email' as the macro name.

This isn't something to do with me being on the 30 day trial???
Reply With Quote
  #4  
Old 07-19-2011, 12:16 AM
macropod's Avatar
macropod macropod is offline VBA macros Windows 7 64bit VBA macros Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi tays01s,

Since the macro recorder apparently captured your 'email' sub, I doubt using a trial version has anything to do with it (unless, perhaps, the trial period has expired).

For a recorded Find/Replace macro, you should see code like:
Code:
Sub Macro1()
'
' Macro1 Macro
'
'
  Selection.Find.ClearFormatting
  Selection.Find.Replacement.ClearFormatting
  With Selection.Find
    .Text = "some text"
    .Replacement.Text = "^&"
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchAllWordForms = False
    .MatchSoundsLike = False
    .MatchWildcards = True
  End With
  Selection.Find.Execute Replace:=wdReplaceAll
End Sub
If you care to describe what you're trying to achieve, I might be able to provide you with something far more efficient than what the macro recorder will give you.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 07-19-2011, 12:36 AM
tays01s tays01s is offline VBA macros Mac OS X VBA macros Office for Mac 2011
Novice
VBA macros
 
Join Date: Jul 2011
Posts: 15
tays01s is on a distinguished road
Default

Yes, that's what I should see and did see in the same Macro in Word X. I tried putting in the Find/Replace code and it still doesn't work.

At the moment I'm more concerned with finding out why Word doesn't work that the actual macro in question..

I've got a trial Office 2011 (mac). Records Excel macros fine. When I record a Word macro including Select all > Find/replace various bits, it all works on screen but when you try to re-run the actual Macro it fails because 'find/replace' aren't recorded within it.

If I copy the contents of my original VBA from Word X to the almost empty 2011 macro, the latter works.

What's going on?
Reply With Quote
  #6  
Old 08-03-2011, 02:01 PM
pkrishna pkrishna is offline VBA macros Windows Vista VBA macros Office 2007
Novice
 
Join Date: Jul 2011
Posts: 16
pkrishna is on a distinguished road
Default

Quote:
Originally Posted by tays01s View Post
I've got a trial Office 2011 (mac). Records Excel macros fine. When I record a Word macro including Select all > Find/replace various bits, it all works on screen but when you try to re-run the actual Macro it fails because 'find/replace' aren't recorded within it.

If I copy the contents of my original VBA from Word X to the almost empty 2011 macro, the latter works.
A similar thing happened when I cropped and resized a picture, and recorded the series of actions as a macro. When it came to run it on a different picture, nothng happened. When I looked into the macro, there was nothing there, other than the sub xxx and End Sub lines.

And ctrl-y doesn't seem to repeat actions for pictures.
Reply With Quote
  #7  
Old 08-03-2011, 09:42 PM
tays01s tays01s is offline VBA macros Mac OS X VBA macros Office for Mac 2011
Novice
VBA macros
 
Join Date: Jul 2011
Posts: 15
tays01s is on a distinguished road
Default

I found the problem for find/replace. If you use the normal find/replace, it doesn't work. However, if you use 'Edit>Advanced find and replace' it does record.

I wonder if there are similar problems in Word? It's a pretty bad bug.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macros nore Outlook 0 06-01-2011 04:39 PM
Macros Steveg Word VBA 0 08-18-2010 04:04 PM
VBA macros Macros Desertwrangler Word VBA 6 06-25-2010 07:06 AM
macros trancetheory Outlook 0 05-11-2010 09:31 AM
VBA macros Macros krdzal Excel 1 04-06-2010 07:43 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:14 AM.


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