![]() |
#1
|
|||
|
|||
![]() I think I'm almost there. I've got the field to appear when I open a new document from a template. However, it only opens as 0000 and does not increase with each new document. I think it might be in the step where you create the Custom Property "InvNum". What "Type" does it need to be? If number, then what value should I enter? Last edited by macropod; 03-16-2016 at 02:54 PM. Reason: Split from http://www.msofficeforums.com/word/7880-sequential-numbering-across-multiple-docs.html |
#2
|
||||
|
||||
![]()
The 'InvNum' property's type can be either Text or Number, with whatever string or number you care to input - all you need is to have something there so that Word can complete the property's creation.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
That makes sense, thanks. Any ideas as to why the number is not increasing?
|
#4
|
|||
|
|||
![]()
InvoiceFile = Options.DefaultFilePath(wdStartupPath) & "\Invoice.ini" 'or, if using a Workgroup folder 'InvoiceFile = Options.DefaultFilePath(wdWorkgroupTemplatesPath) & "\Invoice.ini"
I think it might be that I needed up put my own path of where to save the Invoice.ini file. However, now I'm trying to figure out the syntax, as it's not liking anything that I put in. As I'm on a mac, if my path is: /Users/claire/Library/Application Support/Microsoft/Office/User Templates Then what would I insert here. Is it the spaces in the folder file names with two words (Application Support)? Thanks! |
#5
|
||||
|
||||
![]()
Hi Claire,
What do you get via: Code:
Sub Test() MsgBox Options.DefaultFilePath(wdStartupPath) End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
|||
|
|||
![]()
Hi Paul,
This is what I get... claire$ Sub Test() -bash: syntax error near unexpected token `(' Claires-Production-Mac-2:~ claire$ MsgBox Options.DefaultFilePath(wdStartupPath)-bash: syntax error near unexpected token `(' Claires-Production-Mac-2:~ claire$ End Sub |
#7
|
||||
|
||||
![]()
Hi claire,
Whatever that is, it doesn't look anything like the result of running the macro I posted. Did you actually add the macro to a document's code module and run it? See: http://www.gmayor.com/installing_macro.htm
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#8
|
|||
|
|||
![]()
No, I admit that I got as far as the module part, and then got a bit lost. Also, the macro for changing the color didn't work for me.
I'm definitely a LOT lost in all of this! |
#9
|
||||
|
||||
![]()
Hi Claire,
See attached template. To use it, you should be able to just double-click on it to create a new document. The macros are in the template's 'ThisDocument' module. I've changed the name of the 'AutoNew' macro to 'Document_New) to reflect this, but that's all. If you open the vbe and click onthe template's 'ThisDocument' module, you'll be able to see the code. Likewise, if you click on 'Advanced properties' for either the template or the document and look under 'Custom', you'll see the 'InvNum' property.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#10
|
|||
|
|||
![]()
Thanks so much for this! I've given it a try but haven't had any luck. Could be something that I'm doing (or not doing). This is what I've tried so far...
When I double click on it from my desktop, it opens and shows the field #0000. I opened the template again and the number hadn't increased. I wondered if I needed to save the document for the macro to work, but it still didn't work. Also I've tried 'running' the macro from the macro commands. So I thought that maybe the template needed to be in the My Templates folder and moved it there. I opened a new document from template, and went through the same steps as above, but with no success. In fact when I tried to run the macro from this location, I got the following error... Run-time error '-2147483640 (80000008)' Method 'PrivateProfileString' of object 'System' failed Next I wondered if it was either something to do with a setting on my computer, or that I'm using a mac. So I tried the template from our PC (from the desktop though). This hasn't worked either. What am I doing wrong? |
#11
|
||||
|
||||
![]()
Hi Claire,
It's probably something to do with differences betwen PCs and Macs limiting how the code can save the numbering file used by the template. I'll look into some other options and get back to you. I don't use or have access to a Mac, so it might take a day or three.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#12
|
|||
|
|||
![]()
I failed to notice that on the PC Word, was saying that macros were disabled. So once I turned them on, the template works, so it's definitely a Mac thing.
Yay! Progress ![]() |
#13
|
|||
|
|||
![]()
Hi Paul,
I found this page when looking into the different file paths in macs. http://www.rondebruin.nl/mac.htm I'm wondering if the answer is in the section called "Get Path of Special Folders". It gives some code there, but I'm not sure where to insert it. (It looks like VBA, but it calls it 'mac script' and 'apple script' which is very different.) |
#14
|
||||
|
||||
![]()
Hi Claire,
The issue isn't so much as where a file might be saved, but how it is referenced. In WIndows, I can use 'System.PrivateProfileString', but that isn't supported on the Mac platform. I have found a different technique I can use on both - provided you don't need others to be able to access the sane data for creating their own invoices - but that's probably not going to be much good in a corporate environment. I'll keep looking.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#15
|
||||
|
||||
![]()
Hi Claire,
Try the attached. I think it should work on both platforms.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Add a serial number to an invoice | pringle747 | Excel Programming | 6 | 02-19-2015 11:19 AM |
![]() |
acki | Excel | 7 | 08-14-2013 08:11 PM |
Invoice Statement | Shoshana3 | Word | 0 | 11-15-2010 03:02 PM |
![]() |
mrphilk | Excel | 2 | 06-08-2010 12:39 PM |
Read-Only and Not Opening on Macs | luciddaydream | Word | 0 | 03-15-2010 07:49 PM |