I realise that the use of VBA in modifications and customisations is something that needs to be carefully considered with Microsoft Dynamics GP 2013 including a Silverlight based Web Client which cannot use VBA. I had a requirement from a client for a modification to the Debtor Enquiry (Customer Inquiry to the Americans reading) to include the sum of the displayed transactions on the window and as this was a small client with GP installed locally on each PC there is no requirement for the web client, I felt able to perform this change using Modifier using some VBA.
I added the required fields to the VBA project but encountered an error message when writing the VBA code to concatenate the fields into the SQL statement I was going to use to get the data;
Microsoft Visual Basic: Compile error: Expected: expression
It took me a few minutes to realise that the cause of the error is that To is a restricted keyword in VBA. Once I had realised this, I was able to quickly work around the error by updating the code to refer to the field To with more accuracy;
The red ringed text shows how I got VBA to accept the variable. The Me refers to the Debtor Enquiry window and specifies that To is not a keyword but a child object of the window.
Выдаёт ошибку Expected: expression
в строке
Range("F1").DataSeriesRowcol := xlColumns,Type:=xlLinear,Step:=x_шаг,Stop:=x_пз,Trend:=False
-
Вопрос заданболее трёх лет назад
-
3328 просмотров
Присваиваете свойству кучу параметров, будто функцию вызываете…
Может лучше так — Range(«F1»).DataSeriesRowcol xlColumns,Type:=xlLinear,Step:=x_шаг,Stop:=x_пз,Trend:=False
Пригласить эксперта
Никита, здравствуйте.
Между методом DataSeries и его аргументом Rowcol надо поставить пробел.
Ссылка на официальную справку Микрософт ЗДЕСЬ.
Update: не видел, что в комментарии к своему ответу rosperitus уже озвучил про пробел.
-
Показать ещё
Загружается…
09 февр. 2023, в 11:42
7000 руб./за проект
09 февр. 2023, в 11:23
1500 руб./за проект
09 февр. 2023, в 10:11
1500 руб./в час
Минуточку внимания
-
12-13-2018, 01:51 PM
#1
Registered User
Compile Error: Expected Expression
I am simply trying to export the active sheet as a pdf with the below code, however, I keep getting «Compile error: expected expression» with the ‘:=’ highlight after Filename. Any idea what is causing this error? I see this same line in other users’ code frequently so I’m not sure what I am missing
Thanks!
-
12-13-2018, 02:05 PM
#2
Re: Compile Error: Expected Expression
The line is extended and then broken — try this:
If I’ve helped you, please consider adding to my reputation — just click on the liitle star at the left.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)
You can’t do one thing. XLAdept
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin
-
12-13-2018, 02:06 PM
#3
Re: Compile Error: Expected Expression
It seems is missing «_», put the complete statement in only one ligne.
— Battle without fear gives no glory — Just try
-
12-13-2018, 02:40 PM
#4
Registered User
Re: Compile Error: Expected Expression
Thanks to both of you! Now it is allowing that to work!
Best!
-
12-13-2018, 02:41 PM
#5
Re: Compile Error: Expected Expression
-
12-13-2018, 03:57 PM
#6
Re: Compile Error: Expected Expression
You’re welcome and thanks for the rep!
-
09-09-2022, 02:16 AM
#7
Registered User
Re: Compile Error: Expected Expression
Hi I have been having the same issue, although I have just tried changing it to the same format you suggested and it is still not working. Any suggestions?
-
09-09-2022, 02:20 AM
#8
Re: Compile Error: Expected Expression
Please send a copy of your code
-
09-09-2022, 02:25 AM
#9
Registered User
Re: Compile Error: Expected Expression
I don’t know what I done other then re-typed the whole thing exactly as it was and now it is working again. Here is what I done for a reference. Thanks anyway!
Sub saveaspdf()
Dim invno As Long
Dim custname As String
Dim amt As Currency
Dim dt_issue As Date
Dim term As Byte
Dim path As String
Dim fname As String
Dim nextrec As Rangeinvno = Range(«C3»)
custname = Range(«B10»)
amt = Range(«G38»)
dt_issue = Range(«C5»)
term = Range(«C6»)
path = «/Users/georgiasharp/Library/Mobile Documents/com~apple~CloudDocs/2. GEE’S ISAC/BUSINESS/2022:2023/INVOICES/1. TO PRINT/»
fname = invno & » — » & custnameActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, ignoreprintareas:=False, FileName:=path & fname
Set nextrec = Sheet4.Range(«A1048576»).End(xlUp).Offset(1, 0)
Sheet4.Hyperlinks.Add anchor:=nextrec.Offset(0, 6), Address:=path & fname & «.pdf»
End Sub
-
09-09-2022, 02:40 AM
#10
Re: Compile Error: Expected Expression
-
09-09-2022, 02:44 AM
#11
Registered User
Re: Compile Error: Expected Expression
It’s doing it again.
ActiveSheets.ExportAsFixedFormat:=xlTypePDF, ignoreprintareas:=False, FileName:=path & name
what im doing is right before I run the macro I change the print areas so it only displays the invoice and then I run the macro and it is saying printing area. I tried undoing it and not reseting the print area and it is still saying the same thing.
-
09-09-2022, 03:22 AM
#12
Re: Compile Error: Expected Expression
Hi.
It’s a forum rule that you start your own thread, rather than «piggy-backing» on someone else’s thread. This helps prevent massive confusion arising — which will happen if it is not clear which question is being answered. So please start your own thread and explain your own problem (make sure that, right from the start, you use a meaningful title (NOT things like «help needed» or «urgent problem»… think of the Google search terms that you would use to find the solution).
A picture is worth 1,000 words. An Excel sheet is worth 1,000 pictures. So, prepare a SMALL sample sheet (10-20 rows, not thousands!!!). Make sure there is enough data to demonstrate your need. Make sure your desired results are shown, mock them up manually if necessary. Remember to remove ALL confidential information first!!!
The yellow banner about sample worksheets, at the top of the screen tells you how to post a sheet here on the Forum.
Thread CLOSED.
-
If you would like to post, please check out the MrExcel Message Board FAQ and register here. If you forgot your password, you can reset your password.
-
#1
Hi, I keep getting the error messgae «compile error: expected expression»
VBA also highlights :=
Sub Solve()
SolverOk.SetCell:= «$I$15″, MaxMinVal:=1, ValueOf:=»0″, ByChange:=»$I$3:$I$12»
SolverSolve UserFinish:=True
End Sub
Any ideas? Thanks in advance.
Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
shg
MrExcel MVP
-
#2
Welcome to the board.
Replace the dot after SolverOK with a space.
-
#3
Oh it worked. Thanks a lot.
shg
MrExcel MVP
-
#4
You’re welcome, good luck.
- Threads
- 1,187,204
- Messages
- 5,962,202
- Members
- 438,594
- Latest member
- fptthanhhoas
5 / 5 / 3 Регистрация: 10.09.2013 Сообщений: 51 |
|
1 |
|
10.09.2013, 23:29. Показов 32705. Ответов 5
Помогите, пожалуйста, новичку найти ошибку Миниатюры
__________________
0 |
NikitaQ 5 / 5 / 3 Регистрация: 10.09.2013 Сообщений: 51 |
||||
11.09.2013, 00:36 [ТС] |
2 |
|||
0 |
… 1804 / 1268 / 935 Регистрация: 12.02.2013 Сообщений: 2,063 |
|
11.09.2013, 03:52 |
3 |
NikitaQ, 25 строка, кавычки не те. Посмотрите, даже подсветка синтаксиса для строки не срабатывает. А ещё не понятно, что делает в строке 27 вызов функции main?
0 |
5 / 5 / 3 Регистрация: 10.09.2013 Сообщений: 51 |
|
11.09.2013, 10:56 [ТС] |
4 |
Я скинул отдельную функцию, в программе есть функция main, с ней все нормально) Добавлено через 9 минут
0 |
… 1804 / 1268 / 935 Регистрация: 12.02.2013 Сообщений: 2,063 |
|
11.09.2013, 11:12 |
5 |
NikitaQ, так ведь в 11-ой строке у вас нормальные ASCII-шные парные кавычки, а вот как раз в 25 они не являются таковыми. Вы ради интереса попробуйте пересохранить свой исходник в OEM (CP866) кодировку, и увидите разницу между ними.
0 |
5 / 5 / 3 Регистрация: 10.09.2013 Сообщений: 51 |
|
11.09.2013, 12:43 [ТС] |
6 |
Ох, я и не знал, что есть различия)
0 |
- Forum
- Beginners
- Expected expression error?
Expected expression error?
Can anyone tell me whats going wrong with this program? Trying to implement the trapezoidal rule:
template <class ContainerA, class ContainerB> (!EXPECTED EXPRESSION!)
double trapezoid_integrate(const ContainerA &x, const ContainerB &y) {
if (x.size() != y.size()) {
throw std::logic_error(«x and y must be the same size»);
}
double sum = 0.0;
for (int i = 1; i < x.size(); i++) {
sum += (x[i] — x[i-1]) * (y[i] + y[i-1]);
}
return sum * 0.5;
Do you get the error on the line that you have written (!EXPECTED EXPRESSION!) or is that part of the code?
Last edited on
Yes
Can you give the exact error message? My guess is that you have some problems in the lines above (like a missing or that the error has something to do with the template arguments you use.
All it says on the side is «Parse Issue
Expected Expression»
Can you post a complete example that can be compiled and gives this error?
{
}
template <class ContainerA, class ContainerB>
double trapezoid_integrate(const ContainerA &x, const ContainerB &y) {
if (x.size() != y.size()) {
throw std::logic_error(«x and y must be the same size»);
}
double sum = 0.0;
for (int i = 1; i < x.size(); i++) {
sum += (x[i] — x[i-1]) * (y[i] + y[i-1]);
}
return sum * 0.5;
}
Alright I did that, but i’m still getting the same error message
I can think of a few reasons as to why you’re receiving your error message:
1) You’re missing either a closing brace/parenthesis/bracket/angle-bracket, or a semi-colon before the troublesome line.
2) You’re declaring the template parameters «
ContainerA
«, and «
ContainerB
«, which are currenly in use somewhere else in your code.
Wazzak
Topic archived. No new replies allowed.