Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default filepath variable

Using "filepath = Application.ThisWorkbook.Path" as a statement in a
commandbutton gets me the data I need. Is there any way to put this
statement somewhere so that the data is available in every commandbutton in
the workbook? So I could just use "filepath" everywhere without having to
declare it in every button?\

Using "Public filepath as text" in each worksheet works, but I still have to
make the "filepath=application..." statement in a worksheet.activate section
in every worksheet. I tried putting it in the Workbook declarations section
without success. Any suggestions?

thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default filepath variable

Why use filepath ??

Simple use this in your code
ThisWorkbook.Path & "/" & filenameVar & ".xls"

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"videor" wrote in message . ..
Using "filepath = Application.ThisWorkbook.Path" as a statement in a
commandbutton gets me the data I need. Is there any way to put this
statement somewhere so that the data is available in every commandbutton in
the workbook? So I could just use "filepath" everywhere without having to
declare it in every button?\

Using "Public filepath as text" in each worksheet works, but I still have to
make the "filepath=application..." statement in a worksheet.activate section
in every worksheet. I tried putting it in the Workbook declarations section
without success. Any suggestions?

thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
MDW MDW is offline
external usenet poster
 
Posts: 117
Default filepath variable

Try putting the variable in a VBA module.

Public strMyPath As String

Public Sub get_path()

strMyPath = ThisWorkbook.Path

End Sub


You can call the sub "get_path()" in the workbook_Open event or something.
--
Hmm...they have the Internet on COMPUTERS now!


"videor" wrote:

Using "filepath = Application.ThisWorkbook.Path" as a statement in a
commandbutton gets me the data I need. Is there any way to put this
statement somewhere so that the data is available in every commandbutton in
the workbook? So I could just use "filepath" everywhere without having to
declare it in every button?\

Using "Public filepath as text" in each worksheet works, but I still have to
make the "filepath=application..." statement in a worksheet.activate section
in every worksheet. I tried putting it in the Workbook declarations section
without success. Any suggestions?

thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default filepath variable

why not just use thisworkbook.path whenever you need it, instead of putting
in a variable. But if you must:
put this at the top of a normal module not a worksheet or thisworkbook:

public filepath as string

then set it wherever you like, e.g. in workbook_open and/or
workbook_beforesave

Chris

"videor" wrote in message
. ..
Using "filepath = Application.ThisWorkbook.Path" as a statement in a
commandbutton gets me the data I need. Is there any way to put this
statement somewhere so that the data is available in every commandbutton

in
the workbook? So I could just use "filepath" everywhere without having to
declare it in every button?\

Using "Public filepath as text" in each worksheet works, but I still have

to
make the "filepath=application..." statement in a worksheet.activate

section
in every worksheet. I tried putting it in the Workbook declarations

section
without success. Any suggestions?

thanks




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
Is filepath valid? Mike Excel Programming 0 March 8th 07 07:54 PM
Create filepath if it's not available StephanieH Excel Programming 3 November 8th 05 06:36 PM
Filepath Marie-Jo Excel Discussion (Misc queries) 3 July 5th 05 07:56 PM
Filepath Marie-Jo Excel Discussion (Misc queries) 2 June 30th 05 11:06 PM
get filename and filepath Robert Ehrlich Excel Programming 3 December 21st 03 12:23 PM


All times are GMT +1. The time now is 11:22 PM.

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"