Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.office.developer.vba
external usenet poster
 
Posts: 8
Default Get a specific Program files folder

Hi!

I made a Deploy project in VS2003. The setup copy a xla and a xlt a specific
Program files folder. After the copy, i want to execute a .vbs that will
copy and register the xla and the xlt. My problem is to get my new program
files folder. Is there a vbs code that i can execute to get it?

Thanks,

Thierry Paradis.


  #2   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.office.developer.vba
external usenet poster
 
Posts: 9
Default Get a specific Program files folder

"Thierry Paradis" wrote in message
I made a Deploy project in VS2003. The setup copy a xla and a xlt a specific
Program files folder. After the copy, i want to execute a .vbs that will
copy and register the xla and the xlt. My problem is to get my new program
files folder. Is there a vbs code that i can execute to get it?


This script shows the folder path where the script is located.

' FileName : Setup.vbs
With CreateObject("Shell.Application")
MsgBox .NameSpace(0).ParseName(WScript.ScriptFullName).Pa rent.Items.Item.Path
End With

I use the following script to copy AddIn to default AddIns folder.

' FileName : SetAddIn.vbs
Option Explicit
Const ssfAPPDATA = &H1A: Dim SA, DstF, SrcF, Ans
Ans = MsgBox("Copy AddIn to default AddIns folder", vbOKCancel)
If Ans < vbOK Then WScript.Quit
Set SA = CreateObject("Shell.Application")
Set DstF = SA.NameSpace(ssfAPPDATA).ParseName("Microsoft").Ge tFolder
Set SrcF = SA.NameSpace(0).ParseName(WScript.ScriptFullName). Parent
Call CopyAddins(DstF, SrcF)
MsgBox "Completed."
'
Sub CopyAddins(Dst, Src)
Dim aItem
For Each aItem In Src.Items
If aItem.IsFolder Then
Call CopyAddins(Dst, aItem.GetFolder)' recursive call
Else
Select Case LCase(Right(aItem.Name, 4))
Case ".xla", ".ppa"
Dst.ParseName("AddIns").GetFolder.CopyHere aItem, 16
Case ".dot"
Dst.ParseName("Templates").GetFolder.CopyHere aItem, 16
End Select
End If
Next
End Sub

--
Miyahn (Masataka Miya****a) JPN
Microsoft MVP for Microsoft Office - Excel(Jan 2006 - Dec 2006)


  #3   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.vba,microsoft.public.excel
external usenet poster
 
Posts: 16
Default Get a specific Program files folder

A simpler way you could try:-
If the path to your folderis not going to change, then vba code
ChDir FolderPath - will set your folder as the current folder, where
"FolderPath" is the full path name, including the last \.
Then use Application.GetOpenFilename(...) to display and select the file
you want to import.
If your path is not fixed, but relative to your XL file location, then you
will need to extract the current path from the XL formula
Cell("filename",A1), and concatenate your file path with that.

HTH

"Thierry Paradis" wrote:

Hi!

I made a Deploy project in VS2003. The setup copy a xla and a xlt a specific
Program files folder. After the copy, i want to execute a .vbs that will
copy and register the xla and the xlt. My problem is to get my new program
files folder. Is there a vbs code that i can execute to get it?

Thanks,

Thierry Paradis.



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
Pulling pdf files from general folder to specific folder [email protected] Excel Discussion (Misc queries) 2 September 8th 09 09:41 PM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven Excel Discussion (Misc queries) 1 January 24th 06 03:28 PM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven[_2_] Excel Programming 1 January 24th 06 04:23 AM
Finding the Path to the Program Files Folder JGS[_2_] Excel Programming 2 December 12th 05 09:16 AM
Program Files Folder Scott Gordon Excel Programming 0 May 5th 04 06:26 PM


All times are GMT +1. The time now is 09:47 PM.

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

About Us

"It's about Microsoft Excel"