![]() |
|
#1
|
|||
|
|||
|
I've written several large VB macros for Excel so I know how it works but I now need a simple one for MS Word (in Office 2011 for Mac) where I have no experience at all. Is there a good site to learn from?
In the meantime, this is what I want to do: Public Sub Auto_Open() ' On opening the file, this procedure in TextConverter.doc opens the main procedure ' which opens one .doc file in the folder and saves it as a separate text file. ConvertToText End Sub Private Sub ConvertToText() Dim FileName1 As String FileName1 = clipboard() Documents.Open FileName:=FileName1, ConfirmConversions:=False, _ ReadOnly:=False ActiveDocument.SaveAs FileName:= FileName1 & ".txt", FileFormat:=wdFormatText ActiveWindow.Close Quit EndSub It just opens a .doc file, saves it as a text file and closes the original. Obviously, the line, "FileName1 = clipboard()" throws an error. What is the correct code to assign the clipboard value to the variable, FileName1? I need to convert hundreds of .doc files (in batches of 10 or 20) to text and I propose to call this macro for each one in a group, using Panorama, a database management package that can open a Word document. It's clumsy but I only need to do it once. If there's a simple way for VB to handle a batch of files, great! I just have no idea how to get the file names into the system. In Excel, I had them in cells and stepped through them. michael |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Run Time Error '91': Object variable or With block variable not set using Catalogue Mailmerge | Berryblue | Mail Merge | 1 | 11-13-2014 05:36 PM |
Run-time error 91 object variable or with block variable not set
|
JUST ME | Word VBA | 4 | 03-25-2014 06:56 AM |
| assign variable name to WORD text | norwood | Word VBA | 2 | 09-13-2013 08:00 AM |
object variable or with block variable not set
|
MJP143 | Excel | 1 | 02-11-2013 05:07 AM |
Run-time error '91': Object variable or With block variable not set
|
tinfanide | Excel Programming | 2 | 06-10-2012 10:17 AM |