Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JJ JJ is offline
external usenet poster
 
Posts: 122
Default Saving Workbook with Variable

I have been trying to figure out how to save or open a workbook using a
variable. I keep getting the error "Type-declaration character doesn't match
declared data type". Here is an example of what i am trying to do:

Dim y as string
y = Range("A1")
ChDir "G:the current directory\" & z&
Workbooks.OpenText Filename:= _
"G:the current directory\" & z & "\" & y&
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 313
Default Saving Workbook with Variable

I think you might need double quote marks at the end of the line. One thing I
do is even set the Directory to a variable and use like:

MyDir = "\\YadaYada\SomeFolder\"
MyWrkbName = "My File.xls"

Workbooks.Open Filename:=MyDir & MyWrkbName & ""

"JJ" wrote:

I have been trying to figure out how to save or open a workbook using a
variable. I keep getting the error "Type-declaration character doesn't match
declared data type". Here is an example of what i am trying to do:

Dim y as string
y = Range("A1")
ChDir "G:the current directory\" & z&
Workbooks.OpenText Filename:= _
"G:the current directory\" & z & "\" & y&

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Saving Workbook with Variable

Try this

Dim y As String
y = Range("A1")
ChDir "d:the current directory\" & z & ""
Workbooks.OpenText Filename:= _
"G:the current directory\" & z & "\" & y & ""
-----Original Message-----
I think you might need double quote marks at the end of

the line. One thing I
do is even set the Directory to a variable and use like:

MyDir = "\\YadaYada\SomeFolder\"
MyWrkbName = "My File.xls"

Workbooks.Open Filename:=MyDir & MyWrkbName & ""

"JJ" wrote:

I have been trying to figure out how to save or open a

workbook using a
variable. I keep getting the error "Type-declaration

character doesn't match
declared data type". Here is an example of what i am

trying to do:

Dim y as string
y = Range("A1")
ChDir "G:the current directory\" & z&
Workbooks.OpenText Filename:= _
"G:the current directory\" & z & "\" & y&

.

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
Saving as variable file name leerem Excel Discussion (Misc queries) 1 September 29th 08 10:30 AM
Saving a Workbook: Forcing User to Rename before Saving Rollin_Again[_6_] Excel Programming 5 April 16th 04 02:54 PM
Saving Range Locatoin into a Variable Jake Marx Excel Programming 4 September 10th 03 10:08 PM
Saving Range Locatoin into a Variable Bob Phillips[_5_] Excel Programming 0 September 10th 03 09:13 PM
Saving Registry variable to ini file Allen[_3_] Excel Programming 0 September 10th 03 06:14 PM


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