Help, your directions are great but I am lost. I cannot seem to find the .txt file in the folder C:\Ub_inc\settings.txt and I get all kinds of error messages when I copy and paste the coding from your website in the VBA. I follow the steps up until that point and then I am lost.
I followed your instructions to the letter, and when I bring up my template, the program wants me to run the macro before it will enter the number. How can I fix this?
Hi I'm having trouble with the ActiveDocument 1.57 in your video. It keeps saying "Error Expected: list separator or )" and will not go any further. I'm using an updated version of Microsoft 365. Please, can you help me? Thanks, Sue
Hi, Thanks for this video. Would it be possible, instead of the .txt file can you kindly show us using a "user form" where we can enter the Start "number" and End "number and it prints those numbers from Start "number to the End "number"?
Dear Mr. Michael, I have windows 11, office 2019, i made a settings.text in "C:\Users\badde\OneDrive\Documents\Settings.txt" But cannot make as you describe, please help me. I have made it before few years in my other laptop. But with this new laptop cannot. Hope you will help me this time. Cyril
Did you try it outside of a Onedrive? Usually, when there is a problem, it has to do with the Read / Write or security settings on the drive you're saving the numbers too.
HELLO, I LIKE TO GET MORE INFORMATION ON HOW TO MAKE NUMBERING ON RISO MACHINES TO MAKE RECEIPTS ,TICKETS AND DIFFERENT NUMBERING PRINTINGS .IN ADDITION HOW CAN I ORDER FROM THE PC CONTINUALLY.
I'm in the same jam as Charleston Day School. I've succeed with everything except for locating that file therefore I cannot complete the last task and cant use the invoice! Can you please help and explain to us!
I'm getting a "Debug" that highlights the bottom area where the text file is stored, however, everything appears to be correct. I created the text {MacroSettings} then on the next line Order=1999 in Notepad and it's filed in C drive under a file called Settings.txt. Can u pls advise where I'm going wrong? I've been playing this this for hours! Thanks so much for your video.
It's probably a permission issue now Microsoft doesn't like it when you save stuff directly to the C: drive. Change the location of the file to something other than the C: drive.
Hi! Thanks so much for sharing this! Quick question- if I am inserting Order number in 3 different places in the document, do I have to recreate the macro thrice? It seems to be inserting the number only in 1 of the 3 places.
No, I would first try to copy the bookmark Order into the three different places making sure that they are all named bookmark. If that doesn't work, you simply need to change the part of the code that inserts the number into the document where your bookmarks are. Create three bookmarks named Order, Order1, and Order2 and place them where you want the number to appear in your document. Then copy the second to last line in the code (at 1:58) and paste it two more times one right after the other. In the next two lines change "Order" to "Order1" and "Order2" and save it That should do the trick.
I did everything as instructed but the Pub_in folder does not get created on my C:\ drive? Any help would be immensely appreciated! Please and thank you I get the following error: Run-time error '-2147467259 (80004005)': Method "PrivateProfileString' of object 'System' failed PS: I'm trying to accomplish this using Word 2013 (does the method still apply?)
Hi I just came across your video and it's what I was looking for. I am running windows 10 with office 16 and when i was running the macros it gave me an error on Order = Order + 1. Any ideas on how to fix it
"Order" comes from your text file, so you probably have a typo in either the location of the text file or in the line in the text file that "Order" comes from. I would check the case of the word order to make sure that they match and then the location of the text file it references.
Now that I have set this up it opens the document as path000# and saves it as a blank page so I end up with the document with the name I give it and a duplicate blank document. How can I stop it from doing that? Thanks!!
Hi there. I'm trying out this template and it reads the settings file but it doesn't update the number in the file. The settings file is being saved on a network drive with full permissions. Do you have any other thoughts as to what I can try?
No, I enlisted the help of my IT person and through testing - on our particular network - we determined that the problem was that the script had to be saved on each local computer. Otherwise, it didn't work. We didn't continue trying to get it to work because at that point, it was not going to be worth the effort. Sorry :(
Hi Micheal question, I just viewed this tutorial and used the VBA code provided in 2013, however when i ran it said that the office add on had been disabled by system administrator ??? is that possible or could it be operator error on my part such as: method, property or object variable which it is also eluding too ... and with my limited computer behind the scenes knowledge it very well can be ... bc i am clueless to what any of those things mean ;) pls help thx Lisa
If you're using a computer provided to you by a business or organization, it is very likely that macros and VBA are not allowed for security reasons. You would have to talk to IT. If it is your own personal computer, your situation would be strange.
I was able to create my macro and it works however; it does not run automatically when I open the template. I've checked the permissions on both the template and the text file and they are both fine. Any other suggestions?
Thanks for the tutorial. However, a bit complicated for me to follow, how about do another video for word 2013 (which i own) ? My intention is to create official receipt which hopefully can generate sequence numbers for each receipt i issue.
Doesn't appear to work in Word 2013 since you cannot open a blank template as you did in the video. Do you or anyone know how to make this work in Word 2013?
hi . it is working in Word 2013, put i have a problem that i can't see the invoice number and when i check the Txt file i can see order value is increased by 1...... which is great Waw and will be assume if i can see this number change in my Template... Please if you can explain?
+Enas Sidawi I would suggest proofreading the ActiveDocument.Bookmarks line of code because from what you are describing, all the code works up to that point. Make sure the name of your Bookmark and the name used in that line of code match exactly.
+LearningEngineer.com Thank you so much .... finally it's working ..... my mistake was in the step when i want to try it ... when i do right click on the template i click on Open which is wrong .... then i try to click on New and its working (New creates new word file.Docx include the new number) :-)
@@LearningEngineercom this redirects to a Japanese Page that is blank. I went to your website to find this code but your videos and information on this do not appear there. Can you paste the code here please?
The file is simply a text file that you can place anywhere so long as the location of the file is reflected in your code. For example, if you place the text file on a network drive you might refer to it in your code as H:\settings.txt. "H" stands for the drive letter, and "settings.txt" is the file name. I hope this answers your question.
This worked great for me, however when other people open the document the area where the number goes is blank. I've checked they have have their macros enabled, and that the network drive is the same as the path, but still it doesn't appear to work.
You pull the number from the text file, check to see if a number exists, if it does, add it to 1, the write it back to the text file. Order = System.PrivateProfileString("C:\Settings.txt", _ "MacroSettings", "Order") If Order = "" Then Order = 1 Else Order = Order + 1 End If System.PrivateProfileString("C:\Settings.txt", "MacroSettings", _ "Order") = Order
you lost me at 1:19 :( I think I need a little more marco knowledge to use this video, I can see that you have a text file saved, but that seems to be before step 1 and I am not sure what it should say :(
Thank you for your feedback. The text file simply contains the number that you are saving. If the text file saves the number on a shared drive, others can read and write to it which ensures that no two documents will have the same number. A macro is simply a group of programming code that does something. It should really be called an algorithm for accuracy.
I am having this same issue however I have definitely created the file on the drive and have all the correct permissions. Desperate to get this working!
You can make a text file by opening up any notepad style program and copying what you see at 2:51 and then save it using the name you used in the word document macro. In this case, I named it Settings.Txt
This is Great and it works. Only problem is I have windows 10, office 2013. When open new document it won't change. I need to send invoice to hotels as a travel agent. Need to change invoice no in every invoice which I send. Every time I have to go to view-View Macros-Run. Then it will change number.Help me
I'm trying to insert the current year in front of my number and I'd like the original number to stay in the event i edit and save the doc in years to come. Also, every time I resave the doc, it repeats the number making my number look like this, 000100010001 when all i need is 0001. Other wise the formula is working great and it's eased my mind on the project Im on so thank you very much.
what did you paste on Macro? thnaks!
Does the number change when you need to print 100 documents and each printed document needs to be a different number?
Hi. Where can I find the text that you have been paste it on the macro? Thank you!
Help, your directions are great but I am lost. I cannot seem to find the .txt file in the folder C:\Ub_inc\settings.txt and I get all kinds of error messages when I copy and paste the coding from your website in the VBA. I follow the steps up until that point and then I am lost.
Have i done something wrong i have copied exactly as said changing drive location etc. but when i save doc and start a new 1 number doesn't increase
I followed your instructions to the letter, and when I bring up my template, the program wants me to run the macro before it will enter the number. How can I fix this?
The macro is what generates the number.
Hi I'm having trouble with the ActiveDocument 1.57 in your video. It keeps saying "Error Expected: list separator or )" and will not go any further. I'm using an updated version of Microsoft 365. Please, can you help me? Thanks, Sue
Hi, Thanks for this video. Would it be possible, instead of the .txt file can you kindly show us using a "user form" where we can enter the Start "number" and End "number and it prints those numbers from Start "number to the End "number"?
Does it matter which folder the .txt files is saved in (i.e. does it need to be the C://drive) or can it be saved anywhere on the computer?
No, it doesn't matter. You can even use a network drive. Just make sure you have write privileges.
Is there a way to chage the "Save as" location to be whichever user opens the doc, their "My documents" folder
If you get rid of the "path" and just save it, it automatically saves it to My Documents by default.
Dear Mr. Michael, I have windows 11, office 2019, i made a settings.text in "C:\Users\badde\OneDrive\Documents\Settings.txt" But cannot make as you describe, please help me. I have made it before few years in my other laptop. But with this new laptop cannot. Hope you will help me this time. Cyril
Did you try it outside of a Onedrive? Usually, when there is a problem, it has to do with the Read / Write or security settings on the drive you're saving the numbers too.
I have tried different ways. But not successful. please help me
What did you paste on Macro?
HELLO, I LIKE TO GET MORE INFORMATION ON HOW TO MAKE NUMBERING ON RISO MACHINES TO MAKE RECEIPTS ,TICKETS AND DIFFERENT NUMBERING PRINTINGS .IN ADDITION HOW CAN I ORDER FROM THE PC CONTINUALLY.
I'm in the same jam as Charleston Day School. I've succeed with everything except for locating that file therefore I cannot complete the last task and cant use the invoice! Can you please help and explain to us!
I'm getting a "Debug" that highlights the bottom area where the text file is stored, however, everything appears to be correct. I created the text {MacroSettings} then on the next line Order=1999 in Notepad and it's filed in C drive under a file called Settings.txt. Can u pls advise where I'm going wrong? I've been playing this this for hours! Thanks so much for your video.
It's probably a permission issue now Microsoft doesn't like it when you save stuff directly to the C: drive. Change the location of the file to something other than the C: drive.
When i go to paste in the macro the info you show is not available how do i get it on my clipboard..thx
Hi! Thanks so much for sharing this! Quick question- if I am inserting Order number in 3 different places in the document, do I have to recreate the macro thrice? It seems to be inserting the number only in 1 of the 3 places.
No, I would first try to copy the bookmark Order into the three different places making sure that they are all named bookmark. If that doesn't work, you simply need to change the part of the code that inserts the number into the document where your bookmarks are. Create three bookmarks named Order, Order1, and Order2 and place them where you want the number to appear in your document.
Then copy the second to last line in the code (at 1:58) and paste it two more times one right after the other.
In the next two lines change "Order" to "Order1" and "Order2" and save it
That should do the trick.
I did everything as instructed but the Pub_in folder does not get created on my C:\ drive? Any help would be immensely appreciated! Please and thank you
I get the following error:
Run-time error '-2147467259 (80004005)':
Method "PrivateProfileString' of object 'System' failed
PS: I'm trying to accomplish this using Word 2013 (does the method still apply?)
You have to first create the folder.
Hi I just came across your video and it's what I was looking for. I am running windows 10 with office 16 and when i was running the macros it gave me an error on Order = Order + 1. Any ideas on how to fix it
"Order" comes from your text file, so you probably have a typo in either the location of the text file or in the line in the text file that "Order" comes from. I would check the case of the word order to make sure that they match and then the location of the text file it references.
I have checked the book mark as per the video and it is spelled Order and it still give me an error
Now that I have set this up it opens the document as path000# and saves it as a blank page so I end up with the document with the name I give it and a duplicate blank document. How can I stop it from doing that? Thanks!!
Just get rid of the line of code that starts with ActiveDocument.SaveAs and that should stop it from saving the blank document.
you are amazing! Thank you!
Hi there. I'm trying out this template and it reads the settings file but it doesn't update the number in the file. The settings file is being saved on a network drive with full permissions. Do you have any other thoughts as to what I can try?
I'm having the same problem as you, did you find a solution?
No, I enlisted the help of my IT person and through testing - on our particular network - we determined that the problem was that the script had to be saved on each local computer. Otherwise, it didn't work. We didn't continue trying to get it to work because at that point, it was not going to be worth the effort. Sorry :(
question. why it is saved as macro-enabled document not macro-enabled template?
Yes, you are correct. I should have saved it as a template.
Followed this through to making AutoNew but did not get option to Paste. Any ideas?
Im having same problem ms 2007
Hi Micheal question, I just viewed this tutorial and used the VBA code provided in 2013, however when i ran it said that the office add on had been disabled by system administrator ??? is that possible or could it be operator error on my part such as: method, property or object variable which it is also eluding too ... and with my limited computer behind the scenes knowledge it very well can be ... bc i am clueless to what any of those things mean ;) pls help thx Lisa
If you're using a computer provided to you by a business or organization, it is very likely that macros and VBA are not allowed for security reasons. You would have to talk to IT. If it is your own personal computer, your situation would be strange.
How do I create a Macro button to run this macro with out having to go into the macro
I was able to create my macro and it works however; it does not run automatically when I open the template. I've checked the permissions on both the template and the text file and they are both fine. Any other suggestions?
Did you put the code under AutoNew? Go to 1:16 and see at the top. (General) AutoNew?
This is so useful. thank you very much for sharing this. may i have a copy of the text file you pasted into the macro ?
Thanks for the tutorial. However, a bit complicated for me to follow, how about do another video for word 2013 (which i own) ? My intention is to create official receipt which hopefully can generate sequence numbers for each receipt i issue.
Doesn't appear to work in Word 2013 since you cannot open a blank template as you did in the video. Do you or anyone know how to make this work in Word 2013?
You can open a blank template from
C:\Users\username\AppData\Roaming\Microsoft\Templates.
hi . it is working in Word 2013, put i have a problem that i can't see the invoice number and when i check the Txt file i can see order value is increased by 1...... which is great Waw and will be assume if i can see this number change in my Template...
Please if you can explain?
+Enas Sidawi I would suggest proofreading the ActiveDocument.Bookmarks line of code because from what you are describing, all the code works up to that point. Make sure the name of your Bookmark and the name used in that line of code match exactly.
+LearningEngineer.com Thank you so much .... finally it's working ..... my mistake was in the step when i want to try it ... when i do right click on the template i click on Open which is wrong ....
then i try to click on New and its working (New creates new word file.Docx include the new number) :-)
I searched your learningengineer.com website for the setting.txt file, but could not find it. Can you post it to this vid?
Here is the link. Thank you for bringing the problem to my attention.
www.learningengineer.org/downloads/Settings.txt?attredirects=0&d=1
@@LearningEngineercom this redirects to a Japanese Page that is blank. I went to your website to find this code but your videos and information on this do not appear there. Can you paste the code here please?
The file is simply a text file that you can place anywhere so long as the location of the file is reflected in your code. For example, if you place the text file on a network drive you might refer to it in your code as H:\settings.txt. "H" stands for the drive letter, and "settings.txt" is the file name. I hope this answers your question.
This worked great for me, however when other people open the document the area where the number goes is blank. I've checked they have have their macros enabled, and that the network drive is the same as the path, but still it doesn't appear to work.
+Tim Rawcliffe You would want to check the file permissions on the networked file to make sure that others can, in fact, write to it.
How do you auto advance the number in the text file?
You pull the number from the text file, check to see if a number exists, if it does, add it to 1, the write it back to the text file.
Order = System.PrivateProfileString("C:\Settings.txt", _
"MacroSettings", "Order")
If Order = "" Then
Order = 1
Else
Order = Order + 1
End If
System.PrivateProfileString("C:\Settings.txt", "MacroSettings", _
"Order") = Order
This worked wonderfully, is it possible to reset the numbers to start again at zero? I'd like it to reset for each year.
Absolutely, just open the text file and replace the number with a zero and save it.
Thank you!
you lost me at 1:19 :( I think I need a little more marco knowledge to use this video, I can see that you have a text file saved, but that seems to be before step 1 and I am not sure what it should say :(
Thank you for your feedback. The text file simply contains the number that you are saving. If the text file saves the number on a shared drive, others can read and write to it which ensures that no two documents will have the same number.
A macro is simply a group of programming code that does something. It should really be called an algorithm for accuracy.
I was being asked to debug when I dont see any problem with that line. Please help!!!
Yeah, me too
where do i adjust permissions using word 2016
I was able to get this to work in the year 2024 by starting the macro with Dim Order as String, otherwise it says variable not defined
It says runtime error 5941. The requested member of the collection do not exist.
I NEED HELP...
You probably didn't create your file on the drive.
Debug ??? ActiveDocument.Bookmarks("Order").Range.InsertBefore Format(Order, "0000#")
I am having this same issue however I have definitely created the file on the drive and have all the correct permissions. Desperate to get this working!
This makes no sense from 2:51 - how did you make the text file to create the number? Video makes no sense from here!
You can make a text file by opening up any notepad style program and copying what you see at 2:51 and then save it using the name you used in the word document macro. In this case, I named it Settings.Txt
This is Great and it works. Only problem is I have windows 10, office 2013. When open new document it won't change. I need to send invoice to hotels as a travel agent. Need to change invoice no in every invoice which I send. Every time I have to go to view-View Macros-Run. Then it will change number.Help me
Thanks Mr.Michael, Yes I did everything as you advise. Also all macros enabled.
I don't have a "My Template"
Ctrl+V should do it. However, just to be sure, I will upload a text file at my learningengineer blog.
Dear Mr. Michael
sorry I made a mistake before. And I did correct it.
Now it's working.
Great work.
Thank you very much.
Cyril
I'm trying to insert the current year in front of my number and I'd like the original number to stay in the event i edit and save the doc in years to come. Also, every time I resave the doc, it repeats the number making my number look like this, 000100010001 when all i need is 0001. Other wise the formula is working great and it's eased my mind on the project Im on so thank you very much.
It works for MS Word 2016! like the fact that it made me work at it to understand what was going on to work correctly and it was very easy!!!! *****
How to do this in php
Give me a week, and I'll come up with something.
Dude, if you're gonna do tutorials it's better to talk in them.
Yeah I thought I was the only one who found that odd. Yeah it was so weird, I found the info so helpful but so irritating to watch the video.
Excellent, thanks very much.
*that's Pub