MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Apr 23rd, 2002, 02:10 PM   #1
a_sanchez
New Member
 
Join Date: Apr 2002
Location: Mexico
Posts: 5
Default

I have a searchable data range which points to several PDF files, so I can open them after finding references in Excel.
The question is: Is there a way to open the selected file from within excel via VB?
Please help.
a_sanchez is offline   Reply With Quote
Old Apr 23rd, 2002, 02:29 PM   #2
a_sanchez
New Member
 
Join Date: Apr 2002
Location: Mexico
Posts: 5
Default

Quote:
On 2002-04-23 13:10, a_sanchez wrote:
I have a searchable data range which points to several PDF files, so I can open them after finding references in Excel.
The question is: Is there a way to open the selected file from within excel via VB?
Please help.
Maybe I'd said that I don't want to open the file directly in excel, just give the "order" to AcrobatReader to activate and open the file.
Hope it helps to clarify.
a_sanchez is offline   Reply With Quote
Old Apr 23rd, 2002, 03:15 PM   #3
Jack in the UK
Board Regular
 
Join Date: Feb 2002
Posts: 3,065
Default

can i ask why you wish to do this, is the pdf file reference material, if so can this not be put in excel in own sheet so hyperlink can be used or in own WkBk and opened/viewed...

just finding some back ground

PS what version of Adobe wre the PDF files constructed in or where the bastardised in to pdf... i ask as you only want to view them, so i ask where did these files come from...

yes this does matter.. ill explain.


__________________
Free Excel based Web Toolbar available here.

Jack in the UK
J & R Excel Solutions
"making Excel work for you"
Jack in the UK is offline   Reply With Quote
Old Apr 25th, 2002, 10:49 PM   #4
a_sanchez
New Member
 
Join Date: Apr 2002
Location: Mexico
Posts: 5
Default

Thanks for your answer.
The PDF files came on technical data cd which doesn't work anymore, so I put them in a folder in HD. I created an index so I can search for reference and excel points to filename to open. At this point I switch to Reader and open file.
I'd like to point to reference in Excel and open the Reader's file.
a_sanchez is offline   Reply With Quote
Old Apr 26th, 2002, 01:08 AM   #5
Ivan F Moala
MrExcel MVP
 
Ivan F Moala's Avatar
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
Default

Quote:
On 2002-04-25 21:49, a_sanchez wrote:
Thanks for your answer.
The PDF files came on technical data cd which doesn't work anymore, so I put them in a folder in HD. I created an index so I can search for reference and excel points to filename to open. At this point I switch to Reader and open file.
I'd like to point to reference in Excel and open the Reader's file.
When you say index / points to filename
I'm assuming you mean you have the Full file
name listing in the rows ??
eg.


A
1C:MySiteaccessing-biz-services_.pdf
2C:MySiteDirect Debit Form.pdf
3C:MySiteGMShare.pdf
4C:MySiteOverview Ops Improvement12.01.pdf
5C:MySitereadme.pdf
6C:MySiteshorteval.pdf
7C:MySiteSpreadSheet Modelling Best Practice.pdf
8C:MySitetemplates2.pdf


This table was created by a free Excel macro written by Charles BalchHere's the code. It is care ware - it's yours for free if do something nice for anyone.
Amended @ http://www.gwds.co.nz/ . This File is currently - being amended for the Boards users by Ivan F Moala.



If so then this may help you;


Option Explicit

Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal Hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long


Sub Open_Pdf_FromList()
Dim sPdfFile As String
Dim sFDir As String
Dim X

'// Get Full PDF FileName from Activecell
sPdfFile = ActiveCell.Text
If sPdfFile = "" Then GoTo Check1
If Dir(sPdfFile) = "" Then GoTo Check2

'// Get Directory name Only
X = Split(sPdfFile, Application.PathSeparator)
ReDim Preserve X(0 To UBound(X) - 1)
sFDir = Join(X, Application.PathSeparator) & Application.PathSeparator

'// Get FileName Only
X = Split(sPdfFile, Application.PathSeparator)
sPdfFile = X(UBound(X))

'// Now Open PDF File
ShellExecute 0, "Open", sPdfFile, "", sFDir, 1

Exit Sub
Check1:
MsgBox "Cell is Empty!"
Exit Sub
Check2:
MsgBox sPdfFile & vbCrLf & vbCrLf & "Is not valid or does not exist"
End Sub


Just select the cell reference and run this macro.....
__________________
Kind Regards,
Ivan F Moala From the City of Sails
Ivan F Moala is offline   Reply With Quote
Old Apr 27th, 2002, 12:01 AM   #6
a_sanchez
New Member
 
Join Date: Apr 2002
Location: Mexico
Posts: 5
Default

Thank you very much for kind answer.

It works nice and smooth.
a_sanchez is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 04:20 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes