Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Saving as variable file name | Excel Discussion (Misc queries) | |||
Saving a Workbook: Forcing User to Rename before Saving | Excel Programming | |||
Saving Range Locatoin into a Variable | Excel Programming | |||
Saving Range Locatoin into a Variable | Excel Programming | |||
Saving Registry variable to ini file | Excel Programming |