Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Linking a VBA button to Excel cell

Shell ("C:\Program Files\Adobe"& Range("F4") & ".pdf")

No need to select the range



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default 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
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
Button linking to another cell and sheet SouthernBoy718 Links and Linking in Excel 0 January 7th 07 12:15 AM
Inserting a button into a cell and linking it to a macro Robb W Excel Discussion (Misc queries) 3 May 2nd 06 09:04 PM
Linking Button to a cell MarcB[_3_] Excel Programming 1 October 4th 04 09:35 PM
Linking Button to a cell MarcB[_4_] Excel Programming 1 October 4th 04 06:54 PM
linking radio button paritoshmehta[_20_] Excel Programming 1 June 11th 04 05:23 PM


All times are GMT +1. The time now is 01:58 AM.

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

About Us

"It's about Microsoft Excel"