Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Linking a VBA button to Excel cell
I have tried to locate my answer by looking at the questions and answers from
prior posters, but have been unable to locate what I am looking for. I am looking for a way to combine two results as one, and then look at that new result in a PDF file, that is named the same. I know how to combine two results into a new cell, what I do not know how to do is the VBA coding that needs to be attached so this button can look up the PDF file by the same name. Example: In Excel in cell [B2] you select from a dropdown list say Oregon, and then in another dropdown list in cell [F2] you select Salem. Then in cell, [G2] B2 and F2 would be combined to look like this. [Oregon-Salem] So now, I would click on a button that would go where I store my PDF files, and find and open the file called Oregon-Salem. Any help would be appreciated. Steve |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Linking a VBA button to Excel cell
In my haste to get this question up, I didn't re-read what I wrote. I would
like help in writing this code, not for somebody to do it for me. Sorry about that. Steve "beginner here" wrote: I have tried to locate my answer by looking at the questions and answers from prior posters, but have been unable to locate what I am looking for. I am looking for a way to combine two results as one, and then look at that new result in a PDF file, that is named the same. I know how to combine two results into a new cell, what I do not know how to do is the VBA coding that needs to be attached so this button can look up the PDF file by the same name. Example: In Excel in cell [B2] you select from a dropdown list say Oregon, and then in another dropdown list in cell [F2] you select Salem. Then in cell, [G2] B2 and F2 would be combined to look like this. [Oregon-Salem] So now, I would click on a button that would go where I store my PDF files, and find and open the file called Oregon-Salem. Any help would be appreciated. Steve |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Linking a VBA button to Excel cell
Do all these joined file names live in the same folder?
If so you could do: Shell ("[put file path here]"&[joined name here as a variable or cell reference]&".pdf") This should open your pdf file. Stopher |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Linking a VBA button to Excel cell
Stopher I have a problem. What am I doing wrong in this code. It seems that
VBA is looking for another ")", but I don't see it in the line of code that you gave me. BTW thanks so much for anwering my question. He is the code as I have it now: Shell ("C:\Program Files\Adobe"& Range("F4").Select& ".pdf") "Stopher" wrote: Do all these joined file names live in the same folder? If so you could do: Shell ("[put file path here]"&[joined name here as a variable or cell reference]&".pdf") This should open your pdf file. Stopher |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Linking a VBA button to Excel cell
Shell ("C:\Program Files\Adobe"& Range("F4") & ".pdf")
No need to select the range |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Linking a VBA button to Excel cell
Another thing
Shell ("C:\Program Files\Adobe\"& Range("F4")& ".pdf") Need that extra \ in there as well |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Linking a VBA button to Excel cell
Thanks for the additional help, but I'm stilling getting an error. This time
it is saying: Invalid procedure call or argument So here is my present code with the changes: Shell ("C:\Program Files\Adobe\" & Range("F4") & ".pdf") Steve |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Linking a VBA button to Excel cell
beginner here wrote: Thanks for the additional help, but I'm stilling getting an error. This time it is saying: Invalid procedure call or argument So here is my present code with the changes: Shell ("C:\Program Files\Adobe\" & Range("F4") & ".pdf") Steve Dim newpath as String, sStr as String newpath = "C:\Program Files\Adobe\" sStr = ("cmd /c " & newpath & Range("F4") &".pdf" Call Shell(sStr, vbNormalFocus) Stole this out of a post by Tom and adopted it for your instance. |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Linking a VBA button to Excel cell
Thanks will test this out this morning
"Stopher" wrote: beginner here wrote: Thanks for the additional help, but I'm stilling getting an error. This time it is saying: Invalid procedure call or argument So here is my present code with the changes: Shell ("C:\Program Files\Adobe\" & Range("F4") & ".pdf") Steve Dim newpath as String, sStr as String newpath = "C:\Program Files\Adobe\" sStr = ("cmd /c " & newpath & Range("F4") &".pdf" Call Shell(sStr, vbNormalFocus) Stole this out of a post by Tom and adopted it for your instance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Button linking to another cell and sheet | Links and Linking in Excel | |||
Inserting a button into a cell and linking it to a macro | Excel Discussion (Misc queries) | |||
Linking Button to a cell | Excel Programming | |||
Linking Button to a cell | Excel Programming | |||
linking radio button | Excel Programming |