Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-17-2025, 09:19 AM
10xWords/min 10xWords/min is offline Creating Macro:  I don't seem to be able to achieve this Windows 10 Creating Macro:  I don't seem to be able to achieve this Office 2010
Novice
Creating Macro:  I don't seem to be able to achieve this
 
Join Date: May 2019
Location: Suffolk, UK
Posts: 14
10xWords/min is on a distinguished road
Default Creating Macro: I don't seem to be able to achieve this

Windows 10
Word (MS Office 2019)

This is for local college course. I don't think the tutor knows either, to be honest ( )


I'm trying to create a macro to replicate the attached file WEEKLY MENU - JMN.docx. I've tried numerous ways, techiques etc and spent hours recording but something goes wrong every time I've tried to run it.



For what it's worth, I've been assigning Alt + 2 (deleting the previous attempt each time.


Either the table goes wrong (specified 8 cols x 3 rows); used Table designs for the colouring, used mouse to change font, keyboard Ctrl+B/U for the formatting; title size 18 and table font 12.


The bold doesn't always cancel after typing the title. I've highlighted each table cell to cancel Bold using 'shift and arrow keys' / and mouse, but neither have worked properly - characters come out in different cells etc and still in Bold!!!

I'm now wondering if a macro for this is actually feasible. If so, how should I be doing it, please?

Many thanks if you can help me
Reply With Quote
  #2  
Old 10-17-2025, 09:38 AM
Charles Kenyon Charles Kenyon is offline Creating Macro:  I don't seem to be able to achieve this Windows 11 Creating Macro:  I don't seem to be able to achieve this Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,547
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Why on earth would you use a macro for this?
Just because it is an assignment?
Look into Table Styles for the shading.
Bold, in Word, is a toggle attribute.


The Alt+F3 sounds like you want a macro to change this into a weekly table?
Reply With Quote
  #3  
Old 10-17-2025, 09:56 AM
10xWords/min 10xWords/min is offline Creating Macro:  I don't seem to be able to achieve this Windows 10 Creating Macro:  I don't seem to be able to achieve this Office 2019
Novice
Creating Macro:  I don't seem to be able to achieve this
 
Join Date: May 2019
Location: Suffolk, UK
Posts: 14
10xWords/min is on a distinguished road
Default

Quote:
Originally Posted by Charles Kenyon View Post
Why on earth would you use a macro for this?
Just because it is an assignment?

Yes, purely an academic exercise. Certainly, a template would be more useful, in the 'real' world


Quote:
Originally Posted by Charles Kenyon View Post
The Alt+F3 sounds like you want a macro to change this into a weekly table?
The Alt+3 is just the keyboard keys I assigned to run it, just because you can and is easy to execute LOL It will never actually be 'used' except by the tutor, if he/she so wishes

Thanks. Yes, I frequently use Ctrl+B/U/I and have done for years. I just added this as detail, trying to explain some of what I tried, in case it was significant to the macro's failure

I'd be pleased to learn if, and how, this can be achieved, as a macro. I'm now having my doubts. I can create macros with text, without a problem. I just can't seem to achieve this 'Weekly Menu' table, for whatever reason.

Hope that explains OK
Reply With Quote
  #4  
Old 10-19-2025, 09:05 AM
Charles Kenyon Charles Kenyon is offline Creating Macro:  I don't seem to be able to achieve this Windows 11 Creating Macro:  I don't seem to be able to achieve this Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,547
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

I am moving this to the Word vba Forum.
Please clarify your question.


Do you want your macro to create your sample? That is, a daily menu?
Do you want your macro to create a weekly menu that is patterned after your example, i.e., one column per week?


Do you want this to be a new document?
Do you want this to be added to the end or at the beginning of an existing document?
Reply With Quote
  #5  
Old 10-19-2025, 09:27 AM
10xWords/min 10xWords/min is offline Creating Macro:  I don't seem to be able to achieve this Windows 10 Creating Macro:  I don't seem to be able to achieve this Office 2019
Novice
Creating Macro:  I don't seem to be able to achieve this
 
Join Date: May 2019
Location: Suffolk, UK
Posts: 14
10xWords/min is on a distinguished road
Default

Quote:
Originally Posted by Charles Kenyon View Post
I am moving this to the Word vba Forum.
Please clarify your question.

Do you want your macro to create your sample? That is, a daily menu?


Do you want your macro to create a weekly menu that is patterned after your example, i.e., one column per week?

Do you want this to be a new document?
Do you want this to be added to the end or at the beginning of an existing document?

Thanks Charles


My question is "Is creating a Macro, in Word, to reproduce the title "Weekly Menu' and table with the text, using the 'run' facility or assigned keystrokes, even possible?"


I've made many attempts but have been unable to reporduce the 'image' as it should be.


I'm actually wondering if it's even possible and, if it is, how to achieve this. please? Perhaps, someone with the knowledge/skills in using Word (only) could prove it's possible and to enlighten me as to how to do this, please.



This is an assignment for an IT Skills course so purely an academic exercise to show the ability to create a Macro, in Word. I have emailed the tutor but not heard back, unfortunately.


I appreciate, in real life, this would be better using a template but that's not the purpose of this exercise...

I have no knowledge of VBA, or programming, either so it's not a matter of writing the code, not tweaking the resulting code, I'm afraid.


Thanks very much.
Reply With Quote
  #6  
Old 10-19-2025, 09:35 AM
10xWords/min 10xWords/min is offline Creating Macro:  I don't seem to be able to achieve this Windows 10 Creating Macro:  I don't seem to be able to achieve this Office 2019
Novice
Creating Macro:  I don't seem to be able to achieve this
 
Join Date: May 2019
Location: Suffolk, UK
Posts: 14
10xWords/min is on a distinguished road
Default

Apologies ...

I've just noticed that my 'image' didn't work so I'll try again, so you can appreciate what I'm trying to replicate.

Reply With Quote
  #7  
Old 10-19-2025, 09:43 AM
10xWords/min 10xWords/min is offline Creating Macro:  I don't seem to be able to achieve this Windows 10 Creating Macro:  I don't seem to be able to achieve this Office 2019
Novice
Creating Macro:  I don't seem to be able to achieve this
 
Join Date: May 2019
Location: Suffolk, UK
Posts: 14
10xWords/min is on a distinguished road
Default

Image of what's required



https://ibb.co/bjpQhb8W

Thanks
Reply With Quote
  #8  
Old 10-19-2025, 02:51 PM
macropod's Avatar
macropod macropod is online now Creating Macro:  I don't seem to be able to achieve this Windows 10 Creating Macro:  I don't seem to be able to achieve this Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,489
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

For example:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim Tbl As Table, c As Long, r As Long, ArrDays, ArrMeals
ArrDays = Array("", "", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat", "Sun"): ArrMeals = Array("", "", "LUNCH", "DINNER")
With ActiveDocument.Range
  .Font.Size = 18: .Font.Bold = True: .ParagraphFormat.Alignment = wdAlignParagraphCenter
  .Text = "WEEKLY MENU" & vbCr & vbCr & vbCr
  Set Tbl = .Tables.Add(Range:=.Characters.Last, Numrows:=3, NumColumns:=8)
End With
With Tbl
  .Style = "Grid Table 5 Dark - Accent 6"
  .Range.Font.Size = 10: .Range.Font.Name = "Arial": .Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
  For c = 2 To 8: .Cell(1, c).Range.Text = ArrDays(c): Next
  For r = 2 To 3: .Cell(r, 1).Range.ParagraphFormat.Alignment = wdAlignParagraphLeft: .Cell(r, 1).Range.Text = ArrMeals(r): Next
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 10-19-2025, 02:59 PM
10xWords/min 10xWords/min is offline Creating Macro:  I don't seem to be able to achieve this Windows 10 Creating Macro:  I don't seem to be able to achieve this Office 2019
Novice
Creating Macro:  I don't seem to be able to achieve this
 
Join Date: May 2019
Location: Suffolk, UK
Posts: 14
10xWords/min is on a distinguished road
Default

Thanks Paul
I appreciate your efforts but it isn't code that I need, it's how to achieve recording a macro to result in a replica of the image I attached.


I'm currently trying it, avoiding using the mouse/track pad etc, and using only keystrokes, as I believe Macros don't always recognise actions via the mouse.


Finding, and remembering, the specific keystrokes is proving difficult but I think I'm almost there. Although I like using keystrokes for more common actions, I don't feel it's realistic to use all the necessary keystrokes, in order to record different/various macros, in real life apart from the fact that this particular exercise, in real life, would surely be best in a template
Reply With Quote
  #10  
Old 10-19-2025, 03:20 PM
macropod's Avatar
macropod macropod is online now Creating Macro:  I don't seem to be able to achieve this Windows 10 Creating Macro:  I don't seem to be able to achieve this Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,489
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

Your first post said:
Quote:
Originally Posted by 10xWords/min View Post
I'm trying to create a macro to replicate the attached file Attachment 21711.
I've shown you how to do that. No mention of needing it to be a recorded macro.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #11  
Old 10-19-2025, 03:37 PM
10xWords/min 10xWords/min is offline Creating Macro:  I don't seem to be able to achieve this Windows 10 Creating Macro:  I don't seem to be able to achieve this Office 2019
Novice
Creating Macro:  I don't seem to be able to achieve this
 
Join Date: May 2019
Location: Suffolk, UK
Posts: 14
10xWords/min is on a distinguished road
Default

Again, thanks Paul


It's the title, table with text, that I need to create a macro, in order to replicate, demonstrating I can record the macro.


I'm able to record macros but not this particular type of content, ie the table, formatting and text etc.

I'm not expected to write VBA but to use the macro recording process.


I can only think it doesn't work properly due to using mouse so I'm working on doing it all with keystrokes - definitely a challenge.


It's purely academic, an exercise to demonstrate creating a macro so not for any other purpose.


I was hoping someone, on this forum, would know what techniques etc were necessary to achieve this.


Next class is Weds evening, so it will be interesting if the tutor can shed any light, apart from saying it's due to my computer!!! LOL
Reply With Quote
  #12  
Old 10-19-2025, 04:09 PM
macropod's Avatar
macropod macropod is online now Creating Macro:  I don't seem to be able to achieve this Windows 10 Creating Macro:  I don't seem to be able to achieve this Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,489
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

Here's a macro I recorded. Frankly, I can't see the point of demonstrating that you can record macros...

Code:
Sub Macro1()
'
' Macro1 Macro
'
'
  Selection.EndKey Unit:=wdStory
  Selection.Font.Bold = wdToggle
  Selection.Font.Size = 18
  Selection.Font.Underline = wdUnderlineSingle
  Selection.Font.UnderlineColor = wdColorAutomatic
  Selection.TypeText Text:="WEEKLY MENU"
  Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
  Selection.EndKey Unit:=wdStory
  Selection.TypeParagraph
  Selection.TypeParagraph
  Selection.TypeParagraph
  ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=3, NumColumns:= _
    8, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
    wdAutoFitFixed
  With Selection.Tables(1)
    If .Style <> "Table Grid" Then
      .Style = "Table Grid"
    End If
    .ApplyStyleHeadingRows = True
    .ApplyStyleLastRow = False
    .ApplyStyleFirstColumn = True
    .ApplyStyleLastColumn = False
    .ApplyStyleRowBands = True
    .ApplyStyleColumnBands = False
  End With
  Selection.EscapeKey
  Selection.Tables(1).Style = "Grid Table 5 Dark - Accent 6"
  Selection.Tables(1).Select
  Selection.Font.Bold = wdToggle
  Selection.Font.Size = 10
  Selection.HomeKey Unit:=wdLine
  Selection.MoveRight Unit:=wdCharacter, Count:=8, Extend:=wdExtend
  Selection.Font.Bold = wdToggle
  Selection.Font.UnderlineColor = wdColorAutomatic
  Selection.Font.Underline = wdUnderlineNone
  Selection.MoveLeft Unit:=wdCharacter, Count:=1
  Selection.MoveRight Unit:=wdCharacter, Count:=1
  Selection.MoveRight Unit:=wdCharacter, Count:=7, Extend:=wdExtend
  Selection.Font.UnderlineColor = wdColorAutomatic
  Selection.Font.Underline = wdUnderlineSingle
  Selection.TypeText Text:="Mon"
  Selection.MoveRight Unit:=wdCharacter, Count:=1
  Selection.TypeText Text:="Tues"
  Selection.MoveRight Unit:=wdCharacter, Count:=1
  Selection.TypeText Text:="Wed"
  Selection.MoveRight Unit:=wdCharacter, Count:=1
  Selection.TypeText Text:="Thurs"
  Selection.MoveRight Unit:=wdCharacter, Count:=1
  Selection.TypeText Text:="Fri"
  Selection.MoveRight Unit:=wdCharacter, Count:=1
  Selection.TypeText Text:="Sat"
  Selection.MoveRight Unit:=wdCharacter, Count:=1
  Selection.TypeText Text:="Sun"
  Selection.MoveRight Unit:=wdCharacter, Count:=2
  Selection.TypeText Text:="LUNCH"
  Selection.MoveDown Unit:=wdLine, Count:=1
  Selection.TypeText Text:="DINNER"
  Selection.MoveUp Unit:=wdLine, Count:=1, Extend:=wdExtend
  Selection.Font.UnderlineColor = wdColorAutomatic
  Selection.Font.Underline = wdUnderlineNone
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #13  
Old 10-19-2025, 04:18 PM
10xWords/min 10xWords/min is offline Creating Macro:  I don't seem to be able to achieve this Windows 10 Creating Macro:  I don't seem to be able to achieve this Office 2019
Novice
Creating Macro:  I don't seem to be able to achieve this
 
Join Date: May 2019
Location: Suffolk, UK
Posts: 14
10xWords/min is on a distinguished road
Default

I appreciate what you're saying re having to demonstrate ability to record macros. However, this is for an IT Skills course and part of the assignments, which we must submit.

Copying code is not what the exercise is about, I'm afraid, especially when I don't understand VBA

Thansk anyway
Reply With Quote
  #14  
Old 10-19-2025, 04:26 PM
macropod's Avatar
macropod macropod is online now Creating Macro:  I don't seem to be able to achieve this Windows 10 Creating Macro:  I don't seem to be able to achieve this Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,489
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

Well, if you step through the recorded macro I posted, you can see clearly enough the approach I took.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #15  
Old 10-19-2025, 04:29 PM
10xWords/min 10xWords/min is offline Creating Macro:  I don't seem to be able to achieve this Windows 10 Creating Macro:  I don't seem to be able to achieve this Office 2019
Novice
Creating Macro:  I don't seem to be able to achieve this
 
Join Date: May 2019
Location: Suffolk, UK
Posts: 14
10xWords/min is on a distinguished road
Default

OK, I'll give that a go, hopefully tomorrow, and see what I can make of it I'll try to remember to get back to you to let you know how/if it helps me
Thanks
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating Macro:  I don't seem to be able to achieve this Please help me achieve this Zeus Word 2 12-05-2015 09:54 AM
Can't achieve FULL JUSTIFICATION alignment in Word Singh_Edm Word 20 11-20-2015 02:33 AM
Creating Macro:  I don't seem to be able to achieve this in project 2013 standard how to achieve multi-user editting? Lorrainewjh Project 5 07-01-2015 05:57 PM
Must use VBA to achieve conditional formatting along with expanding table columns? tinfanide Excel 0 06-10-2015 12:25 AM
How do you achieve Falling letters? PPT PowerPoint 0 04-21-2012 06:12 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:27 PM.


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