Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




To Connect An Indiv. Filetype/extension With A Specific Macro


Hello Experts,

how can I manage that WIN-XP opens a specific EXCEL-Workbook if I double-click on a file with an extension "created" by myself. The called EXCEL-Macro embedded in the Workbook shall know where to find this file and open/read it. I know where to tell WIN-XP the link between filetype and application. But how to define an EXCEL-Worbook as "application" in this meaning?

Thanks for help,

Johannes




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Connect Comandbutton To A Specific Macro?
How and where do I connect a command button to a recorded macro?

/G

Locating The File With Specific Extension
Would any one help me to solve the problem??

I am writing a vb program by using vb 6.0. I want to location a file with .id extension. how can i find out this file c:/program/abc.id if i only know the extension and the path??

Thank you very much~~

Copy Files With A Specific Extension
I keep on getting error when i try to copy all files with a specific extension.

FileCopy "c:Off-line*.bbl", "c:windows*.bbl"

Any suggestions?

Thanks

Finding Files With A Specific Extension
Hi,
I need to check if there are specific files (with extension .img) present on the computer.
Does someone know how this could be accomplished.
I already tried it through some api functions but I can't give any wild cards with them.

THANKS.

Locating The File With Specific Extension
Would any one help me to solve the problem??

I am writing a vb program by using vb 6.0. I want to location a file with .id extension. how can i find out this file c:/program/abc.id if i only know the extension and the path??

Thank you very much~~

Connect Dbase With Self Define Extension
Please HElp...

If I want to connect to a DBase database and the extension is self define, how can it be done. how should i write the connection string.

My database is DBase III but my extension used is not ".dbf" but ".db"

How To Find All The Files Of A Computer With An Specific Extension? *RESOLVED*
Hey guys! I have a code to find a specific file... Then I tryed to change it to find all the files with a specific extention, like ".htm"

But it seens not working... I already tryed "*.htm" and chr$(42) & ".htm"...

Here is my piece of code...

For driveexist = 0 To Drive1.ListCount
driveletter = Left$(Drive1.List(driveexist), 2)
file = FindFile(driveletter & "", "open.html") 'I am trying here to make it search from *.extension of the file
If file <> "" Then
Exit For
End If
Next


Anybody have ideas to solve it? =-)

thanks guys!

Elminster

Macro To Remove Extension Off A File Name
I need to write a macro in excel that will take a file name like 320451r.lft located in a cell, drop the .lft and place the characters ahead of the decimal point into another cell. I've been looking through the help section to try and find a function that I can use but no luck so far. I'm pretty new to VB and I'm not aware of the majority of functions. Please help.

Thanks

Alin

Spliting Indiv Chars
Hello,

I want to split chars into indiv.

Ex.

I have "TEST"

How I can I make the output, "T E S T".

Thanks

How To Connect With Specific Criteria
hi all,

i already create a crystal report. i dont how to connect throuhg vb with specific criteria. any help is appreciated

saj

Not Sure Where To Post This... {connect Through Specific Port}
Hope this is right.
Problem as follows:
I am making a connection to a remote SQL server, like this:

cnAll.ConnectionString = "Provider=SQLOLEDB; Data Source=123.54.24.12; initial catalog=sddb"

My problem is that I have to connect through a specific port, for instance port 2233. Is there anywhere I can specify this?

Hope someone can help me...

IMPORTANT QUESTION -&gt; Is It Possible To Connect To Specific Directory On An FTP Site?
Is it possible to programmatically connect to specific directory on an FTP site?

e.g.
My FTP Site: ftp://10.103.10.0
The directory I want to connect to: dir1/dir2/dir3

I can do this manually by entering: ftp://10.103.10.0/dir1/dir2/dir3 in the address field.

How Do I Run A Macro At A Specific Time
I am using MS ACCESS 2000 and want to have a SendObject macro run each day at midday, i have been told it is possible although i cannot find out how.

Any Ideas?

Regards
Matt

Run Macro At Specific Time
At 3:00pm daily, I want to output "DONE" in a specified cell. However, I cannot get the OnTime method to work automatically. Do I need to create an event? I have a subroutine that simply outputs done to a cell:

Sub fillCell
Range("E4").Value = "DONE"
End Sub

How do I run this automatically at 3pm? TIA.

Run Macro On Specific Day Of Week
looked everywhere for a simple solution... none to be found

Just want to do the following:


Code:
If Weekday = Saturday then...
'Run this code
End if

I have looked in MS Help, Mr. Excel, MSN.com & Here...Nothing
Any help would be appreciated
Thanks

Run Macro At Specific Time
Hi,

I was wondering if you can run macro's in excel automatically at a certain time?

Cheers

White Magic

Starting Macro When A Specific Value Changes
I want to start a macro when in a specific cell a value is entered or changed.
If tried this:

vb
Private Sub Worksheet_Change(ByVal Target As Range)

If Range("b27").Value > 0 Then
Call hydraulic_nut
End If

End Sub

Sub hydraulic_nut()
Dim S As String
S = WorksheetFunction.VLookup(Range("b27").Value, Sheets(3).Range("A2:B45"), 2, False)
Range("b28").Value = S
End Sub

vb
But the program gets very slow when i start an other macro (which put many results of the sheet)
What is the solution?

Maarten

End A Loop Macro At A Specific Row??
Ok here is the deal. I want this macro to loop until it hits row 515, no matter what is in the cells. Right now of course it keeps going until it finds an empty cell. Any ideas??

Do While ActiveCell.Value <> ""
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.Cut
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(1, -1).Range("A1").Select
Selection.Cut
ActiveCell.Offset(0, 2).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(1, -2).Range("A1").Select
Selection.Cut
ActiveCell.Offset(0, 3).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(1, -3).Range("A1").Select
Selection.Cut
ActiveCell.Offset(0, 4).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(1, -4).Range("A1").Select
Loop
End Sub

Thanks,
Michael

Run Macro On Specific Cell Change
Is there a way to have a VB Macro run when a specific cell changes value ? I am able to have a macro run when a "sheet data change" takes place, but do not know how to isolate a specific cell to be watched, while ignoring any other changes to the sheet.

Thanks in advance for any help !!!

Running A Macro On A Specific DAY &amp; Time
I know about the On Time Method... However can this method be modified to run on a specific Day as well as time...say Wednesday @ 3:00pm...Or is there another method that covers both Day & Time automation...

Thanks...

Not Linking A Macro To A Specific Workbook
I have created a few Macros but they are linked to the workbook. So stupid question, but how do I make it so that ANY time I open a workbook, the code can be run but not be directly linked to to a workbook. In other words, every month I receive a new workbook and I want to run a macro to clear a bunch of cells out (which works) but it always goes back to the original workbook.

Is there a place all my code should be? I have 2 macros saved in the toolbar and I wan to open ANY sheet and us the macro?


Edit by Moderator:
Please post Excel questions, in the Excel forum.

Thank you.

Connect Macro(VB) To Sql Server
Can any body pls. help me..here's my problem. I have a excel file with macro in it(i used VB6 editor to make/edit Macro) and i want my macro to retrive some data from my Sql database. My question is, how will i connect my macro to my Microsoft SQL server (Version 8)? any inputs will be greatly appreciated..thanks in advance!!!

Macro To Delete Specific Text Box In PowerPoint
Hello, I have quite a few presentations, all which I didn't create, where some bright person manually put in page numbers in text boxes at the bottom of each slide instead of adding them in the footer. Is there anyway I can run a macro that will cycle throught the slides and delete them automatically? I have never even bothered with VBA in PowerPoint, mainly Excel and some Access, so I have no idea where to start.

I recorded a macro to try to grasp the syntax but like I said, I don't know what to do. (It always seems to name each text box "Rectangle 2")


ActiveWindow.Selection.SlideRange.Shapes("Rectangle 2").Select
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select
ActiveWindow.Selection.ShapeRange.Delete


Any help on this would be great. I could manually delete them but there are at least 50 slides in multiple presentations.....absolutely ridiculous.

On a slide number note......I've searched the help files for this but someone might know it off hand. Is it possible to insert slide numbers after the presentation is created? I would think you'd be able to but I cannot.

Thanks.

Use Macro To Find A Specific Word In Excel
Hi all,

I need the help as currently i have created a vb program which link to excel worksheet. The program has to search for example "FREIGHT" word in EXCEL column B. If the column B has such "FREIGHT" wording, the program should stamp "FOUND" in column C else nothing will stamp in column c.
I can use below script to find the "FREIGHT", but my question is how to set "FOUND" in column C if the "FREIGHT" wording is found in column b? Anybody got any clue on it ?

ExcelSheet.Columns.Find(What:="FREIGHT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Activate

Please help!
Thanks!

From,
Siaw Ch'ng

Firing A Macro On Selecting Specific Sheet
The subject says it all really.

How can I get Excel to fire a macro when one of the sheets in my workbook is selected?

Thanks

Francis Neil Beans

Connect Excel To Access With Macro (VBA)
I am trying to connect Excel to Access and I learned that I would have to write a Macro script (VBA code) that will allow user to upload their Excel data to Access. I am new to Macro so can someone guide me on how I should approach this situation.
In Excel, there are 7 columns however in Access there are 5 columns. Some columns in Excel are combined in Access into 1. So, I need a way to combine some columns before uploading to Access. Also, the user would have the copy of it for their reference.

Macro For Excel To Copy Data To Specific Worksheet - Help!
I need help creating a macro for Excel. My workbook has 13 worksheets in it. The first worksheet is for data entry - where the user types in the call information. Each of the other 12 worksheets are labeled by month. What I want is a macro that will copy the row of data (record) onto the corresponding month's worksheet.

For example, a call comes in on January 3, 2002. The employee puts in the date of the call, the problem and the solution in adjacent cells in the same row. I want a Macro to automatically copy that row's data onto the January worksheet, in the first empty row.

Any ideas?
Thanks!
Beth

Use Excel Macro To Delete Rows With Specific Data In Cells
I need some help writing a macro that deletes a row (or number of rows) in a worksheet. We have an appointment scheduling app that exports the data in .CSV format. I run a macro that formats this .CSV file so we can insert it into another .XLS sheet that gets emailed to our retail locations to post their daily appointments. What I would like to automate is removing multiple rows that have N A in the firstname & lastname columns. Is there someway to "delete any row that has N in column c and A in column d"? We use the N A as fake names to fill in time slots we don't want to make "real" appointments. Now I have those times blocked out and have to manually delete each one before copying into the formatted worksheet that's mailed to the individual stores. Thanks for any and all help! TommyT.

Connect An Image To A Macro Made Private. Excel.
A little more that one hour into the new year here in Sweden: Happy New Year!

It is easy to connect a macro to a picture when it is a macro that starts Sub. Excel gives good info about that. How shall I do to connect an image to a Private macro? No box comes up and Excel does not give info (as far as I have found). I have not found anything here either.

I am much obliged for help on this matter.



Edited by - benes on 1/4/2007 2:18:18 AM

Filetype ID
If someone could tell me how to select all the files of same file type in a file list box and store them in a variable or something similiar. thanks

Filetype ?
I have downloaded some examples with VB code and can see
that one of the application use *.cdx , *.dbf and *.fpt files.
What kind of format / database is it ?

FileType
How can u get the file type of a file
eg: the file is a .zip file, then is the filetype "Winzip File"

New FileType And Connections
Hi,

If you're wondering, what the heck my "subject" meant, you may need to read further

The problem:
How do I set a default file type (e.g., *.vvv) to open up in my own program?

Example:
Microsoft Word, when installs, it registers *.doc or *.dot to open up in word, when ever the user double clicks it.

I want to make my program create a filetype (e.g., *.vvv), and when ever user clicks on that *.vvv file, I want my app to run, opening it.

Any ideas? sites? tutors? help?

Thanks very much.

Icon Of A Filetype
I know this might be a lot to ask, but can somebody please tell me how (or point me to somewhere that does) to

1) Get the icon for a certain filetype, eg: get the notepad icon if a .txt file opens with notepad by default.

2) Make your program the default program for a certain filetype.

I'm not asking you to make these for me, just point me in the right direction to learn how, google didn't help

Get Information From Different Filetype.
hey there again..

I wondering, I have created a file with notepad with some text within it, the thing is that I call this file "test.adon" instead of "test.txt".
Will there be any problems getting the information from the file using FileSystemObject? Or do I have to do this another way?

thx
Sandallic

Check Filetype
Hi there.

I want to know if it is possible to look inside imagefiles, and read the file type (or even if it is possible to do with any file type).

eks. I have a file without any extension, and want to chek if it is a bitmap.....

Can it be done ?
And how can it be done ?

Get Filetype From GetSaveFileName
I use the code below to save a playlist. As you can see, there are different filetypes. How do I determine wich filtype is chosen without looking at the returned filename (the extension of two types are the same). I also would like to be able to set the default type (ie, the next time the same type is selected)

I know this can be done with the commondialog control, so I hope it can be done here...

(I dont use the commondialog control because I need the ownerhwnd)


Code:
Public Function ShowSave(OwnerHwnd As Long, Optional Title As String, Optional Filter As String, Optional initdir As String, Optional FilterIndex As Byte) As String
'Set the structure size
OFName.lStructSize = Len(OFName)
'Set the owner window
OFName.hwndOwner = OwnerHwnd
'Set the application's instance
OFName.hInstance = App.hInstance
'Set the filet"Text Files (*.txt)" + Chr$(0) + "*.txt" + Chr$(0) + "All Files (*.*)" + Chr$(0) + "*.*" + Chr$(0)
If Filter <> "" Then
OFName.lpstrFilter = Filter
Else
OFName.lpstrFilter = "All Files (*.*)" + Chr$(0) + "*.*" + Chr$(0)
End If
'Create a buffer
OFName.lpstrFile = Space$(254)
'Set the maximum number of chars
OFName.nMaxFile = 255
'Create a buffer
OFName.lpstrFileTitle = Space$(254)
'Set the maximum number of chars
OFName.nMaxFileTitle = 255
'Set the initial directory
If initdir <> "" Then
OFName.lpstrInitialDir = initdir
ElseIf SaveDir <> "" Then
OFName.lpstrInitialDir = SaveDir
Else
OFName.lpstrInitialDir = App.Path
End If
'Set the dialog title
If Title <> "" Then
OFName.lpstrTitle = Title
Else
OFName.lpstrTitle = "Save File"
End If
'no extra flags
OFName.flags = 0

'Show the 'Save File'-dialog
If GetSaveFileName(OFName) Then
ShowSave = Trim$(OFName.lpstrFile)
Else
ShowSave = ""
End If

End Function

Folder Containing FileType ONLY
I'm using this SHBrowseforFolder API (that I don't understand how it works, but it does), but I need the 'OK' button to be Greyed out until the folder selected has one or more files with the file extension I'm looking for, ex. .BIN, .TXT.. you get the picture...


Code:
Option Explicit
Private Type BrowseInfo
hwndOwner As Long
pIDLRoot As Long
pszDisplayName As Long
lpszTitle As Long
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End Type

Private Const BIF_RETURNONLYFSDIRS = 1
Private Const MAX_PATH = 260

Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)
Private Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long

Public Function BrowseForFolder(hwndOwner As Long, sPrompt As String) As String

'declare variables to be used
Dim iNull As Integer
Dim lpIDList As Long
Dim lResult As Long
Dim sPath As String
Dim udtBI As BrowseInfo

'initialise variables
With udtBI
.hwndOwner = hwndOwner
.lpszTitle = lstrcat(sPrompt, "")
.ulFlags = BIF_RETURNONLYFSDIRS
End With

'Call the browse for folder API
lpIDList = SHBrowseForFolder(udtBI)

'get the resulting string path
If lpIDList Then
sPath = String$(MAX_PATH, 0)
lResult = SHGetPathFromIDList(lpIDList, sPath)
Call CoTaskMemFree(lpIDList)
iNull = InStr(sPath, vbNullChar)
If iNull Then sPath = Left$(sPath, iNull - 1)
End If

'If cancel was pressed, sPath = ""
BrowseForFolder = sPath

End Function

Save As Filetype
Is there a code for saving the contents of a textbox to a certain type of file?
i.e. i'm trying to make a VBS editor

Find And Retreive All Of A Certain Filetype From A Url
Is there any way to search a web page and all deeper links
(ex: something.com ,something.com/somethingelse) for a certain file type such as .gif and or *me.jpeg and download all of those files. and record a record of each file download so at a later date the same file is not dowloaded again?

Finding Files With Same Filetype
I need someone to tell me how you can locate files of a same type in a chosen directory and can someone please tell me something that would allow me to see what files were in a directory.
Thanks

Registered Filetype On Install..
I'm just wondering if its atall possible, (and if so how) to make my package register filetypes when its installed, like how Word registers files with a *.doc extension, and also how to make opening one of the registered files shell my application and load up the file, I've made a lot of apps before but never any with their own user accessible filetype, I'd usually get around it by making sure the user opens the file within the program everytime they want to use it, but my client wants it like I said..

Finding Out Filetype Of Program
How do I go about listing the type of file a program is? Like in windows Explorer you can have .gif,.jpg and .bmp images all listed with a type of 'Paint Shop Pro'?

Anyone have any code that achieves this or that can point me in the right direction please?

Muchos gracias

Default OCX Filetype In Registry
Could someone just take a look at their windows registry and tell me what they have for a value under this key?

HKEY_CLASSES_ROOT.ocx

Im trying to find the default value...

FileType Icons In Listview
Hej
I have a huge problem !, can any one tell how to get filetype icons in Listview, filetypes icons drawn from the registry or shell.dll ?
I can reach the icon in the registry but are only able to show it in a picturebox, listview will not accept them.
I have realilized that the color deep for icons in listview must only be 256, it that the problem or..

I would be very happy if any one knows .

best regards
John


Setting FileType Associations
Hey,

I want to be able to setup filetype associations to open with my program during the setup process. Could anyone tell me how this could be done?

Need Help Searching Folders For Filetype, Using That Data
Hey everyone! I've been browsing these forums for a while but this is the first post I've made. I've searched multiple times for something like this but I can't seem to find what I need.

I have a converter program that needs three inputs:
1) The pathname of the file that needs to be converted
2) The pathname of where I want the converted file
3) The pathname of where I want the log file the converter makes


Right now, this all depends on the user typing it into 3 textboxes. What I want to do is:
1) Search through user-specified directory for "*.lib" files
2) Use the first file and run it through the converter
3) Repeat until all files in diretory are converted

I will keep searching the forums, but help here would be appreciated greatly.

Problem When Checking For Valid Filetype
Hello, I'm using the code below to check how many valid avi videos there are in a folder.

Every time a valid avi video has been found, 1 should be counted up (ct). This works fine if there are only valid avi videos in the folder, but if I rename a mp3 audio file to .avi and put that file in the folder with the valid avi videos, then ct always returns "0".

Does anybody know what is wrong?


VB Code:
Public Function GetFileType(xFile As String) As String    On Error Resume Next    Dim ID As String * 300     Open xFile For Binary Access Read As #1    Get #1, 1, ID    Close #1    GetFileType = Mid(ID, 9, 8)End Function   Private Sub cmdCheck_Click()  Dim ct As Integer  Dim a As String  Dim Valid_type As String   ct = 0  a = sPath & Dir(sPath & "*.avi")  Valid_type = GetFileType(a)    Do While LenB(a) > LenB(sPath)        If Valid_type = "AVI LIST" Then    ct = ct + 1    End If        a = sPath & Dir  Loop Msgbox ct End Sub

Adding Filetype - Refresh Icons
When I add a new filetype in VB6 under Win98 the associated icon won't show up when browsing files, not even after pressing F5, only after restarting will the proper icon be displayed how can I alleviate this.

Copyright © 2005-08 www.BigResource.com, All rights reserved