Solved

Use data to create Hyperlink..?

Posted on 2000-03-14
8
164 Views
Last Modified: 2010-05-02
I want to know how it is possible to insert a search for a specific file.  At the moment I have a hyperlink to an Excel file called C:\Test\Test_01_01_2000.xls and another C:\Test\Test_02_01_2000.xls, basically every day a new file is created in the format. Test(filename)_01(day)_02(month)_2000(year).  What i would like to accomplish is to insert something like 3 text boxes on my form called ,day ,month and year.  Once the user inserted the data in the text boxes and you click the Submit button it should point to the relevant hyperlink. For example in the text box Day the user inserted 05 and the textbox month the user inserted 03 and textbox year the user inserted 2000, once inserted and you click the submit button the the results should the point to C:\Test\Test_05_03_2000.xls
0
Comment
Question by:fouchev
  • 4
  • 2
  • 2
8 Comments
 
LVL 43

Expert Comment

by:TimCottee
Comment Utility
What are you using to create your hyperlink? The hyperlink will normally take the form of a string:

"file://c:/test/test_01_01_2000.xls" this could easily be built up as you describe.
0
 
LVL 1

Author Comment

by:fouchev
Comment Utility
Edited text of question.
0
 
LVL 1

Author Comment

by:fouchev
Comment Utility
Edited text of question.
0
 
LVL 1

Author Comment

by:fouchev
Comment Utility
Very quick there Tim,

Well at the moment the the hyperlink is under the properties of a command button called btnSubmit. Once I change the data in the text boxes, i need the hyperlink in the button properties to change accordingly.  Is this clearer?
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 2

Accepted Solution

by:
gelog earned 50 total points
Comment Utility
Why do you use textboxes for date input? It is more elegant solution to use DateTimePicker (Calendar) Control.

Include to a project Windows Common Controls - 2. Place the DateTimePicker on the form, also add the button control.

Insert the following code to the from code module:

Private Sub Command1_Click()
    MsgBox Command1.Tag
End Sub

Private Sub DTPicker1_Change()
   
    With DTPicker1
        Command1.Tag = "C:\Test_" & Day(.Value) & _
            "_" & Month(.Value) & "_" & Year(.Value) & ".xls"
    End With
           
End Sub

Run the project, click on the buuton, you sould see the result in a message box.

0
 
LVL 43

Expert Comment

by:TimCottee
Comment Utility
Are you using a DHTML project, VB Script or ActiveX document model to do this with? Gelog's comment is possibly helpful as it may well be a nicer interface to go with, however you would still have to format the date parts correctly to get "01" instead of "1" for the day and month.

0
 
LVL 1

Author Comment

by:fouchev
Comment Utility
Hi again,
I works fine, it displays in the message box, but how do get it to go to the file (hyperlink) now. Must one put code behind the Ok button or what..?  
0
 
LVL 2

Expert Comment

by:gelog
Comment Utility
Insert in the Global_Declarations section of the form code module the following API declaration:

Private 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

In the Command1_Click event procedure insert the call of ShellExecute instead of the call of MsgBox:


ShellExecute 0&, "Open", Command1.Tag, 0&, 0&, 1&
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now