LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.misc
Patricia Shannon
 
Posts: n/a
Default macro to print files from a list of links

In looking thru the msgs this morning, I discovered the Shell function, which
can execute another program, eg. Word. You could precede it with Sendkeys.

"Patricia Shannon" wrote:

Other possibilities:
4) Open both Excel and the program suitable for printing the files, eg.
Word or Notepad. From Excel, use "SendKeys" to switch to the other pgm, open
the file, print it, close it, and transfer control back to your Excel pgm.
Eg. in "SendKeys", Alt+Tab is "%{TAB}" , which switches to the other pgm.

5) Use "Print #" to write the filenames to a file. Then you would have to
have a macro in the other pgm to read the filenames from this file, with
"Line Input #" and print the files. You will also need "Open #" and "Close
#" statements.

"Patricia Shannon" wrote:

In case you need it, I did find the Hyperlink base in
BuiltInDocumentProperties.
It was Activeworkbook.BuiltInDocumentProperties(29)
I don't know if the item number would vary between Excel versions. I have
Excel 2003.

"Patricia Shannon" wrote:

I have included a macro that runs through the hyperlinks on the spreadsheet
and prints their addresses in the immediate window, to get you started

I haven't had occasion to do what you want to do, so the rest of this is
what I would try if I were doing it.

How to proceed from there depends on the type of files you're printing. If
they are Excel files, it should be easy. You have the Open, PrintOut, and
Close methods.

If you have a hyperlink base that you need to use, you might be able to get
it with BuiltInDocumentProperties. If worse comes to worse, you could
specify it in an input box (which allows for a default if appropriate), or
put it in a particular cell or named range in the worksheet itself.

1) You can use FileCopy or Copyfile to copy the files to a folder, then
print the files outside of Excel, from Window Explorer. You might already
know you can print a group of files from Windows Explorer.

2)You could modify this macro to do a "Follow" or "FollowHyperlink", then a
"SendKeys", sending the appriate keys to print and close the file. Eg, for a
Word document, Alt+P to print, Alt+F E to exit. See Help for specifics.

3) If that doesn't work, you can use hyperlink address to set up an
interaction with whatever a program (eg., Word) that can process your files
and has VBA capability. This is something I've never done, but it is shown
in "Excel 2003 VBA Programmer's Reference" by Paul T. Kimmel and other, and
I'm sure in other books.


Sub PrintHyperlinks()
' Created by Patricia Shannon April 2006

Dim ThisHyperlink As Hyperlink
Dim ThisHyperlinkAddress As String

For Each ThisHyperlink In ActiveSheet.Hyperlinks
ThisHyperlinkAddress = ThisHyperlink.Address
Debug.Print "hyperlink="; ThisHyperlinkAddress
Next

End Sub



"jim9912" wrote:

On my PC


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
running a macro from a list rufusf Excel Worksheet Functions 0 February 22nd 06 04:38 PM
Creating Links to files in a shared directory grewpp Excel Discussion (Misc queries) 4 February 9th 06 04:22 PM
Macro to open print window and set to print entire workbook retseort Excel Discussion (Misc queries) 1 October 27th 05 11:00 PM
Macro Help In Excel welshlad Excel Discussion (Misc queries) 14 October 26th 05 02:34 PM
How do I record a macro which should work on multiple files ? Venkataraman.P.E Excel Discussion (Misc queries) 2 January 16th 05 10:26 AM


All times are GMT +1. The time now is 12:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"