Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Almost there
I got help from the group last night in how to give the file a dynamic
file name using a macro, I was given the following VB CODE: Sub test() Dim Path As String Path = "C:\Documents and Settings\Richard Sabbara\Desktop\" With ActiveWorkbook .SaveAs Filename:=Path & .Worksheets("Sheet1").Range("C1").Value & ".xls", _ FileFormat:=xlNormal, _ Password:="", _ WriteResPassword:="", _ ReadOnlyRecommended:=False, _ CreateBackup:=False End Sub Now the problem that I am having is more basic, when I try and run this macro, I get the error message: Compile Error: Expected End With I am missing something basic here, what is it? Thanks, Richard |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Almost there
Sub test()
Dim Path As String Path = "C:\Documents and Settings\Richard Sabbara\Desktop\" With ActiveWorkbook .SaveAs Filename:=Path & .Worksheets("Sheet1").Range("C1").Value & ".xls", _ FileFormat:=xlNormal, _ Password:="", _ WriteResPassword:="", _ ReadOnlyRecommended:=False, _ CreateBackup:=False End With End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) wrote in message ups.com... I got help from the group last night in how to give the file a dynamic file name using a macro, I was given the following VB CODE: Sub test() Dim Path As String Path = "C:\Documents and Settings\Richard Sabbara\Desktop\" With ActiveWorkbook .SaveAs Filename:=Path & .Worksheets("Sheet1").Range("C1").Value & ".xls", _ FileFormat:=xlNormal, _ Password:="", _ WriteResPassword:="", _ ReadOnlyRecommended:=False, _ CreateBackup:=False End Sub Now the problem that I am having is more basic, when I try and run this macro, I get the error message: Compile Error: Expected End With I am missing something basic here, what is it? Thanks, Richard |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Almost there
Yes, not reading the error message.
It tells you are missing an "End With" before the "End Sub". NickHK wrote in message ups.com... I got help from the group last night in how to give the file a dynamic file name using a macro, I was given the following VB CODE: Sub test() Dim Path As String Path = "C:\Documents and Settings\Richard Sabbara\Desktop\" With ActiveWorkbook .SaveAs Filename:=Path & .Worksheets("Sheet1").Range("C1").Value & ".xls", _ FileFormat:=xlNormal, _ Password:="", _ WriteResPassword:="", _ ReadOnlyRecommended:=False, _ CreateBackup:=False End Sub Now the problem that I am having is more basic, when I try and run this macro, I get the error message: Compile Error: Expected End With I am missing something basic here, what is it? Thanks, Richard |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Almost there
It works wondefully, thank you all so much, you have saved me HOURS of
work. If you anyone can recommed a good VB book, I am open to suggestions, I am at a new job, I currently work with SQL a lot, however this I am seeing the need to do more and more with VB and Excel, while these boards are a great source of knowledge, I would like to increase my own known personal knowledge base. Thank you all again. Richard NickHK wrote: Yes, not reading the error message. It tells you are missing an "End With" before the "End Sub". NickHK wrote in message ups.com... I got help from the group last night in how to give the file a dynamic file name using a macro, I was given the following VB CODE: Sub test() Dim Path As String Path = "C:\Documents and Settings\Richard Sabbara\Desktop\" With ActiveWorkbook .SaveAs Filename:=Path & .Worksheets("Sheet1").Range("C1").Value & ".xls", _ FileFormat:=xlNormal, _ Password:="", _ WriteResPassword:="", _ ReadOnlyRecommended:=False, _ CreateBackup:=False End Sub Now the problem that I am having is more basic, when I try and run this macro, I get the error message: Compile Error: Expected End With I am missing something basic here, what is it? Thanks, Richard |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Almost there
Your response seems a bit harsh. Remember not all participants have the same
knowledge as you or I. We're here to be helpful. -- Best wishes, Jim "NickHK" wrote: Yes, not reading the error message. It tells you are missing an "End With" before the "End Sub". NickHK wrote in message ups.com... I got help from the group last night in how to give the file a dynamic file name using a macro, I was given the following VB CODE: Sub test() Dim Path As String Path = "C:\Documents and Settings\Richard Sabbara\Desktop\" With ActiveWorkbook .SaveAs Filename:=Path & .Worksheets("Sheet1").Range("C1").Value & ".xls", _ FileFormat:=xlNormal, _ Password:="", _ WriteResPassword:="", _ ReadOnlyRecommended:=False, _ CreateBackup:=False End Sub Now the problem that I am having is more basic, when I try and run this macro, I get the error message: Compile Error: Expected End With I am missing something basic here, what is it? Thanks, Richard |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Almost there
Eyeman - I'd recommend pretty much anything by John Walkenbach, especially
the "Bible" series (there's versions for each release of excel). They've been an immense help to me as I've been learning how to use excel and VBA. You can get them through most decent bookshops. HTH DS " wrote: It works wondefully, thank you all so much, you have saved me HOURS of work. If you anyone can recommed a good VB book, I am open to suggestions, I am at a new job, I currently work with SQL a lot, however this I am seeing the need to do more and more with VB and Excel, while these boards are a great source of knowledge, I would like to increase my own known personal knowledge base. Thank you all again. Richard NickHK wrote: Yes, not reading the error message. It tells you are missing an "End With" before the "End Sub". NickHK wrote in message ups.com... I got help from the group last night in how to give the file a dynamic file name using a macro, I was given the following VB CODE: Sub test() Dim Path As String Path = "C:\Documents and Settings\Richard Sabbara\Desktop\" With ActiveWorkbook .SaveAs Filename:=Path & .Worksheets("Sheet1").Range("C1").Value & ".xls", _ FileFormat:=xlNormal, _ Password:="", _ WriteResPassword:="", _ ReadOnlyRecommended:=False, _ CreateBackup:=False End Sub Now the problem that I am having is more basic, when I try and run this macro, I get the error message: Compile Error: Expected End With I am missing something basic here, what is it? Thanks, Richard |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Almost there
Dunno, made me smile, and the OP didn't seem to take offence.
-- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Jim Jackson" wrote in message ... Your response seems a bit harsh. Remember not all participants have the same knowledge as you or I. We're here to be helpful. -- Best wishes, Jim "NickHK" wrote: Yes, not reading the error message. It tells you are missing an "End With" before the "End Sub". NickHK wrote in message ups.com... I got help from the group last night in how to give the file a dynamic file name using a macro, I was given the following VB CODE: Sub test() Dim Path As String Path = "C:\Documents and Settings\Richard Sabbara\Desktop\" With ActiveWorkbook .SaveAs Filename:=Path & .Worksheets("Sheet1").Range("C1").Value & ".xls", _ FileFormat:=xlNormal, _ Password:="", _ WriteResPassword:="", _ ReadOnlyRecommended:=False, _ CreateBackup:=False End Sub Now the problem that I am having is more basic, when I try and run this macro, I get the error message: Compile Error: Expected End With I am missing something basic here, what is it? Thanks, Richard |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Almost there
Maybe I hadn't had enough coffee yet to be rational. My apologies.
-- Best wishes, Jim "Bob Phillips" wrote: Dunno, made me smile, and the OP didn't seem to take offence. -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Jim Jackson" wrote in message ... Your response seems a bit harsh. Remember not all participants have the same knowledge as you or I. We're here to be helpful. -- Best wishes, Jim "NickHK" wrote: Yes, not reading the error message. It tells you are missing an "End With" before the "End Sub". NickHK wrote in message ups.com... I got help from the group last night in how to give the file a dynamic file name using a macro, I was given the following VB CODE: Sub test() Dim Path As String Path = "C:\Documents and Settings\Richard Sabbara\Desktop\" With ActiveWorkbook .SaveAs Filename:=Path & .Worksheets("Sheet1").Range("C1").Value & ".xls", _ FileFormat:=xlNormal, _ Password:="", _ WriteResPassword:="", _ ReadOnlyRecommended:=False, _ CreateBackup:=False End Sub Now the problem that I am having is more basic, when I try and run this macro, I get the error message: Compile Error: Expected End With I am missing something basic here, what is it? Thanks, Richard |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Almost there
It wasn't meant to be too mean, but the OP did ask "I am missing something
basic here, what is it?". The answer, I felt, was Yes. NickHK "Bob Phillips" bl... Dunno, made me smile, and the OP didn't seem to take offence. -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Jim Jackson" wrote in message ... Your response seems a bit harsh. Remember not all participants have the same knowledge as you or I. We're here to be helpful. -- Best wishes, Jim "NickHK" wrote: Yes, not reading the error message. It tells you are missing an "End With" before the "End Sub". NickHK wrote in message ups.com... I got help from the group last night in how to give the file a dynamic file name using a macro, I was given the following VB CODE: Sub test() Dim Path As String Path = "C:\Documents and Settings\Richard Sabbara\Desktop\" With ActiveWorkbook .SaveAs Filename:=Path & .Worksheets("Sheet1").Range("C1").Value & ".xls", _ FileFormat:=xlNormal, _ Password:="", _ WriteResPassword:="", _ ReadOnlyRecommended:=False, _ CreateBackup:=False End Sub Now the problem that I am having is more basic, when I try and run this macro, I get the error message: Compile Error: Expected End With I am missing something basic here, what is it? Thanks, Richard |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Almost there
For the record, I didn't take offense, I got the answer that I needed,
I have saved HOURS of work as a result, thank you all for your help. NickHK wrote: It wasn't meant to be too mean, but the OP did ask "I am missing something basic here, what is it?". The answer, I felt, was Yes. NickHK "Bob Phillips" bl... Dunno, made me smile, and the OP didn't seem to take offence. -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Jim Jackson" wrote in message ... Your response seems a bit harsh. Remember not all participants have the same knowledge as you or I. We're here to be helpful. -- Best wishes, Jim "NickHK" wrote: Yes, not reading the error message. It tells you are missing an "End With" before the "End Sub". NickHK wrote in message ups.com... I got help from the group last night in how to give the file a dynamic file name using a macro, I was given the following VB CODE: Sub test() Dim Path As String Path = "C:\Documents and Settings\Richard Sabbara\Desktop\" With ActiveWorkbook .SaveAs Filename:=Path & .Worksheets("Sheet1").Range("C1").Value & ".xls", _ FileFormat:=xlNormal, _ Password:="", _ WriteResPassword:="", _ ReadOnlyRecommended:=False, _ CreateBackup:=False End Sub Now the problem that I am having is more basic, when I try and run this macro, I get the error message: Compile Error: Expected End With I am missing something basic here, what is it? Thanks, Richard |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|