LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default setting a file with variables

well, i was close!
:)
susan


John Bundy (remove) wrote:
You need to take quotes out of this
FName = "MyPath&MyFile"
like
FName = MyPath & MyFile
--
-John Northwest11
Please rate when your question is answered to help us and others know what
is helpful.


"timmulla" wrote:

Can anyone help me with the following code. I'm having trouble setting the
FName variable using two other variables (MyPath and MyFile.

MyPath variable
"C:\Documents and Settings\tmullady\Desktop\"

MyFile Variable
contents in cell B3 in my spreadsheet

The end result should be the FName variable should create the proper file
path.



Public Sub Testing()

Dim MyFile As String
MyFile = Cells(3, 2).Text
Dim MyPath As String
MyPath = "C:\Documents and Settings\tmullady\Desktop\"

Dim FName As String
Dim FNum As Integer
Dim Rng As Range
FName = "MyPath&MyFile"
FNum = FreeFile
Open FName For Output Access Write As #FNum
Print #FNum, Range("B3").Text
For Each Rng In Range("B5:B10")
Print #FNum, Rng.Text
Next Rng
Close #FNum

End Sub


Any help would be appreciated
--
Regards,

timmulla


 
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
setting a file with variables Susan Excel Programming 0 January 18th 07 02:54 PM
Need help with setting variables erikkeith via OfficeKB.com Excel Programming 5 November 1st 06 01:28 PM
Setting several variables at the same time BenderBender Excel Programming 1 March 28th 06 09:50 PM
Setting Public Variables Error clmarquez[_10_] Excel Programming 8 January 16th 06 05:25 PM
Setting variables to Nothing Matt Jensen Excel Programming 5 January 12th 05 02:25 AM


All times are GMT +1. The time now is 11: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"